diff options
Diffstat (limited to 'src/socket.cpp')
-rw-r--r-- | src/socket.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/socket.cpp b/src/socket.cpp index bd05024..5a3097c 100644 --- a/src/socket.cpp +++ b/src/socket.cpp | |||
@@ -276,3 +276,15 @@ bool Bu::Socket::isOpen() | |||
276 | return bActive; | 276 | return bActive; |
277 | } | 277 | } |
278 | 278 | ||
279 | Bu::FString Bu::Socket::getAddress() const | ||
280 | { | ||
281 | struct sockaddr_in addr; | ||
282 | socklen_t len = sizeof(addr); | ||
283 | addr.sin_family = AF_INET; | ||
284 | getsockname( nSocket, (sockaddr *)(&addr), &len ); | ||
285 | char buf[150]; | ||
286 | sprintf( buf, "%s", inet_ntoa( addr.sin_addr ) ); | ||
287 | |||
288 | return buf; | ||
289 | } | ||
290 | |||