Re: [gnet] IP address of a TCP client



David,

I think you misunderstood my question: according to the doc,
gnet_tcp_socket_get_inetaddr() for a server doesn't return the address of
the client but only the localhost, which is pretty useless...
Instead, it would be great if it could return the IP of the connected
client. This is very useful when you want to send an UDP socket to a client
which just got connected via TCP.

-Olivier

Doc:
>  GInetAddr*  gnet_tcp_socket_get_inetaddr    (const GTcpSocket *socket);
>
> Get the address of the socket. If the socket is client socket, the
address is
> the address of the remote host it is connected to. If the socket is a
server
> socket, the address is the address of the local host. (Though you should
> use gnet_inetaddr_gethostaddr() to get the GInetAddr of the local host.)

David Helder wrote:

> Yes, use gnet_tcp_socket_get_inetaddr()
>
> David
>
> On Fri, 21 Sep 2001, Olivier Michel wrote:
>
> > Hello,
> >
> > How is it possible with gnet to know the IP address of a remote client
> > connecting to a server via a TCP socket ?
> > In SDL_net, there is a very handy function for this:
> > SDLNet_TCP_GetPeerAddress(TCPsocket sock);
> > Is there any equivalent function in gnet ?
> >
> > Thanks,
> >
> > -Olivier
> >


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]