From 2e00e0151fc0648e7dc5a1eb348610da1633a4cd Mon Sep 17 00:00:00 2001 From: fcolin Date: Tue, 6 Oct 2009 15:37:04 +0000 Subject: 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 --- src/ivysocket.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/ivysocket.c') 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; -- cgit v1.1