2008. 8. 21. 11:04
How can I get IP address of my Pocket PC device?
2008. 8. 21. 11:04 in 3. Implementation/Network
Question
I write a wireless application for Pocket PC. I want to get current IP address of Pocket PC in my program (like "192.168.131.101"). How can I do it?
Answer
You can use Winsock for that. First of all you should understand that one device can have several IP addresses. Sample code here finds the first one.
gethostbyname function returns information structure about a host. h_addr_list field of this structure contains list of addresses of the host. Finaly inet_ntoa function will conver IP address to a string.
To use winsock functions you should include winsock.h header and link with winsock.lib library.
Source code
출처 : http://www.pocketpcdn.com/articles/ip.html