diff options
author | fcolin | 2009-10-06 15:37:04 +0000 |
---|---|---|
committer | fcolin | 2009-10-06 15:37:04 +0000 |
commit | 2e00e0151fc0648e7dc5a1eb348610da1633a4cd (patch) | |
tree | e22e2017b35638852ed8772bd6163a6131e40be7 /src/ivysocket.c | |
parent | 8f86104d18dd95c54d41b1d0eac21b2bb1f30d39 (diff) | |
download | ivy-c-2e00e0151fc0648e7dc5a1eb348610da1633a4cd.zip ivy-c-2e00e0151fc0648e7dc5a1eb348610da1633a4cd.tar.gz ivy-c-2e00e0151fc0648e7dc5a1eb348610da1633a4cd.tar.bz2 ivy-c-2e00e0151fc0648e7dc5a1eb348610da1633a4cd.tar.xz |
correction des problemes de connection multiple
et de l'emission du message ready
on d'uigne, et les suivantes ci-dessous, seront ignorées--
M ivysocket.c
M ivysocket.h
M ivy.c
Diffstat (limited to 'src/ivysocket.c')
-rw-r--r-- | src/ivysocket.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ivysocket.c b/src/ivysocket.c index 3fe723d..bf1b76c 100644 --- a/src/ivysocket.c +++ b/src/ivysocket.c @@ -406,6 +406,27 @@ char *SocketGetPeerHost (Client client ) return host->h_name; } +unsigned short int SocketGetLocalPort ( Client client ) +{ + int err; + struct sockaddr_in name; + socklen_t len = sizeof(name); + + if (!client) + return 0; + + err = getsockname (client->fd, (struct sockaddr *)&name, &len ); + if (err < 0 ) return 0; + return name.sin_port;; +} +unsigned short int SocketGetRemotePort ( Client client ) +{ + if (!client) + return 0; + + return client->from.sin_port; +} + struct in_addr * SocketGetRemoteAddr (Client client ) { return client ? &client->from.sin_addr : 0; |