I need help "binding" to a specific IP address.
My program is able to "bind" when using inaddr_any, but I can't seem to bind to a specific IP address using inet_addr("...."). I am basically trying to "bind" a socket to MY home pc's IP address, and a random port number (but the program simply refuses to bind to my home pc's IP address).
Can someone please help me to bind a socket to a specific IP address? Thanks in advance.
I've heard that a PC generally has around two to three IP addresses in total. I'm using the IP address that was obtained off of: http://www.whatismyip.com/ I'm guessing that that is the "router" IP address. I am NOT using 127.0.0.1.
Yes, that will be your router address. Which is not equivalent to your PC address.
Other than that, your code is correct.
If you are using Windows XP, open up My Network Places, then under "Network Tasks" on the left click on "View Network Connections". You will then see a list of your connections. You should see something like "Local Area Connection 1", "Local Area Connection 2" etc.
One of these will look like two *blue* computers. The rest will either be grey or have a red X on them. On the blue coloured icon, double click it and it will say Local Area Connection status. Click on the "Support" tab and you will see some Status about your connection. You are interested in the field called "IP Address". That is the local machine address and the one which you need to bind to.
I started working on a windows forms authentication project, which uses nhibernate, and has some management pages for managing user settings, such as resetting user password. This forms based authentication ...