diff options
Diffstat (limited to 'util/sock.cpp')
-rw-r--r-- | util/sock.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/util/sock.cpp b/util/sock.cpp index 9c22fa58139..b88cb5bb08e 100644 --- a/util/sock.cpp +++ b/util/sock.cpp @@ -19,6 +19,16 @@ #include "stdafx.h" #include "sock.h" +static boost::mutex sock_mutex; +// .empty() if err +string hostbyname(const char *hostname) { + boostlock lk(sock_mutex); + struct hostent *h; + h = gethostbyname(hostname); + if( h == 0 ) return ""; + return inet_ntoa( *((struct in_addr *)(h->h_addr)) ); +} + void sendtest() { cout << "sendtest\n"; SockAddr me(27016); |