diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-09-07 20:27:47 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-09-07 20:27:47 +0000 |
commit | ace50b182f318b96a87505aa3d6b509959d49544 (patch) | |
tree | 3262ddba1ae2ecb4a70ca73fec6f732a097e2c72 | |
parent | 2ebc1f4a48656d6141633effe03cde6904a14473 (diff) | |
download | libbu++-ace50b182f318b96a87505aa3d6b509959d49544.tar.gz libbu++-ace50b182f318b96a87505aa3d6b509959d49544.tar.bz2 libbu++-ace50b182f318b96a87505aa3d6b509959d49544.tar.xz libbu++-ace50b182f318b96a87505aa3d6b509959d49544.zip |
The Bu::Socket::getAddress function was always getting the local name of the
socket, i.e. your address, not the client's address. That's not what I had
intended, but it'd be nice to have later. This is corrected now.
-rw-r--r-- | src/socket.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/socket.cpp b/src/socket.cpp index ce4ee82..94b4d60 100644 --- a/src/socket.cpp +++ b/src/socket.cpp | |||
@@ -304,7 +304,8 @@ void Bu::Socket::setAddress() | |||
304 | struct sockaddr_in addr; | 304 | struct sockaddr_in addr; |
305 | socklen_t len = sizeof(addr); | 305 | socklen_t len = sizeof(addr); |
306 | addr.sin_family = AF_INET; | 306 | addr.sin_family = AF_INET; |
307 | getsockname( nSocket, (sockaddr *)(&addr), &len ); | 307 | // getsockname( nSocket, (sockaddr *)(&addr), &len ); |
308 | getpeername( nSocket, (sockaddr *)(&addr), &len ); | ||
308 | char buf[150]; | 309 | char buf[150]; |
309 | sprintf( buf, "%s", inet_ntoa( addr.sin_addr ) ); | 310 | sprintf( buf, "%s", inet_ntoa( addr.sin_addr ) ); |
310 | sAddress = buf; | 311 | sAddress = buf; |