Re: [gnet] how to get *server* ip address?
- From: David Helder <dhelder umich edu>
- To: Axel Bock <news-and-lists the-me de>
- Cc: GNet List <gnet gnetlibrary org>
- Subject: Re: [gnet] how to get *server* ip address?
- Date: Fri, 10 Jan 2003 16:33:40 -0500 (EST)
0.0.0.0 means all interfaces, so it could be using more than one address.
gnet_inetaddr_list_interfaces() will get you an actual list of interfaces.
gnet_inetaddr_get_internet_interface() will use heuristics to get an
interface that GNet thinks is connected to the internet. This is what I
use in Jungle Monkey to autodetect the address.
David
On Fri, 10 Jan 2003, Axel Bock wrote:
> Hi all,
>
> i'm having a little problem: I'm writing a client-server p2p app, and I
> need to get the IP address the clients connect to my server.
>
> I do this to get it:
>
> addr2 = gnet_tcp_socket_get_inetaddr(server);
> name2 = gnet_inetaddr_get_canonical_name(addr2);
> port2 = gnet_inetaddr_get_port(addr2);
>
>
> but this doesnt work. the port comes out right, but the name2 is always
> 0.0.0.0. but the client HAS to connect to a *certain* ip, and this ip I
> want to have! (for example: intranet-ip is 10.0.0.1 and external IP is
> something completely different).
>
> any ideas please? this is quite important for me cause i'm in deep time
> trouble ... :-)
--
__ _ __ David Helder - dhelder umich edu
___/ /__ __ __(_)__/ / <http://www.eecs.umich.edu/~dhelder>
/ _ / _ `/ |/ / / _ / DiaWebLog: <http://www.diaweblog.org>
|_,_/|_,_/|___/_/|_,_/ Paper CD Case: <http://www.papercdcase.com>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]