diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-06-28 22:47:03 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-06-28 22:47:03 +0000 |
commit | f896b0e207e0b656109ef0e9f721f27ce53a836e (patch) | |
tree | 1e93590ef779bd4d443a6dc302564c6673012afb /src/socket.cpp | |
parent | afb50f535dd60b485a38f1f1f692b3303e28fecc (diff) | |
download | libbu++-f896b0e207e0b656109ef0e9f721f27ce53a836e.tar.gz libbu++-f896b0e207e0b656109ef0e9f721f27ce53a836e.tar.bz2 libbu++-f896b0e207e0b656109ef0e9f721f27ce53a836e.tar.xz libbu++-f896b0e207e0b656109ef0e9f721f27ce53a836e.zip |
Client code is better, so is the socket, you can get addresses and other cool
things from it. The plugger had yet another bugfix...plugger...
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 | |||