IP of server in socket

Dec 15, 2014 at 8:46pm
hello!
i'm beginner and need your helps.
i've wrote a program that uses socket to connect to it's client but after writing all the code, I don't know what ip i should set to my bind ipaddr, is that should be my internet ip?

thanks!
Dec 15, 2014 at 8:58pm
you can work on your program just fine without worrying about ip addresses, just on your computer ofc. Or you can set the "test ip" 127.0.0.1 for testing purposes.
Dec 15, 2014 at 9:12pm
i tested it but i want to check it on different computers
Last edited on Dec 15, 2014 at 9:19pm
Dec 15, 2014 at 9:43pm
Then, yes I believe you need to assign your own IP address.
Dec 16, 2014 at 9:46am
i did that but it couldn't bind!!
Dec 16, 2014 at 10:36am
Are the two computers on the same LAN? Then make sure you use the local IP.

Are the two computers communicating over the Internet? Then you have to make sure to use the global IP address, but it still might not work depending on how the computers are connected. If one of the computers are behind a router with NAT then you might have look into port forwarding to make it work.

http://en.wikipedia.org/wiki/NAT
http://en.wikipedia.org/wiki/Port_forwarding
Dec 17, 2014 at 9:08am
if i set ip address INADDR_ANY what will happen?
Topic archived. No new replies allowed.