On Mon, 14 Jul 2014 02:13:34 +0900 Baek Seung Hoon <[email protected]> said:
> hello, I developed tizen application using sockets. > > but I can't get my address in socket and anywhere. > > I searched in google, i don't know it. > > how can i get a my ip address in socket or netendpoint class or anything? > > thanks you you know there isn't just a single "your ip address". you need to know the interface you want the ip address of, and then an interface can have more than one. given routing and such, the most reliable way is to get the ip address of a specific tcp connection (as routing may alter out of which interface it exits from), so once you have a connection or are listening on a port - try getsockname() on the socket. (read the standard unix/linux manuall pages on this and google for use/examples) and even then that ip address may not be the same address you see from "the rest of the world" (if you are behind a NAT etc.). so i find the idea of needing your "ip address" to be "suspicious" (likely a bad idea - if you want it for reconnecting back in from the outside, then that may fail due to NAT or because the device is asleep). -- Carsten Haitzler (The Rasterman) <[email protected]> _______________________________________________ Dev mailing list [email protected] https://lists.tizen.org/listinfo/dev
