IP with Winsock?
I cant find anything on how to give my peice of software a known IP address and have it connect, all the tutorials are getting the IP from the hostName, but I just want to give it like 127.0.0.1 and have it go there (except use an Internet IP) Anyone have a code snippet or something?
What langauge and what api? (win32, .net) Also are you trying to get the IP address of your machine or someone elses?
theTroll
theTroll
Ack my internet crashed and somehow it sent the post before i finished typing, it occured to me to check the articles on gamdev, a new one since the last time has the answer. Sry for the inconveinece. BTW I was using C++ and Winsock 1.1.
inet_aton ("ip"); does what i need. Thx
inet_aton ("ip"); does what i need. Thx
this page has all the info you need. the specific thing of how to connect to an IP address is also covered. just give the page a read-through
http://johnnie.jerrata.com/winsocktutorial/
specifically here's a code snippet from the page that's dealing with your question:
-me
http://johnnie.jerrata.com/winsocktutorial/
specifically here's a code snippet from the page that's dealing with your question:
LPHOSTENT hostEntry;in_addr iaHost;iaHost.s_addr = inet_addr("204.52.135.52");hostEntry = gethostbyaddr((const char *)&iaHost, sizeof(struct in_addr), AF_INET);if (!hostEntry) { // Handle accordingly}
-me
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement