Hi. I made a program for tcp chat but I'm really confused with which IP to use. I can send a message to myself by sending a message to a local IP such as 127.0.0.1 or 192.168.1.100. When I tried with my external IP (the one from whatsmyip.com) I get a socket exception: The requested address is not valid in its context. In order to chat to a friend what IP does he have to give me, and if it's the external how do I get the program to work?

Is your buddy behind a router??

Is your buddy behind a router??

Well he isn't, but the program is supposed to work dependless of whether the person I'm connecting to is behind a router or not.

I think you have to give the ip your server is running on to your friend. Or if he is the one running the server, then you have to use his ip to connect to that server. Hope this helps.

By the way, you can also refer to source code for chat applications at sourceforge.

I think you have to give the ip your server is running on to your friend. Or if he is the one running the server, then you have to use his ip to connect to that server. Hope this helps.

By the way, you can also refer to source code for chat applications at sourceforge.

Yes I know, but which ip are you talking about? The external?

Just try using the external ip.

On the router try to Port Forward the port of your chat to the computer on the other side using it's internal IP.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.