Click here to Skip to main content
15,443,281 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I made a program using the socket class in C# which is a chat program. In LAN network I can work with it, but over the internet I can't.
Can you guide me?

Thanks in advance!
Updated 16-Jan-11 11:40am
Espen Harlinn 16-Jan-11 17:45pm    
Good work Manfred!

First of all check whether your app is connected to internet using this link.. can you see me[^] put your listing port no and hit check button..

If it failed probably you are listnig on or your LAN address (like
so change your listing interface address to IP shown on this link[^].
that is you computer's global IP (IP on internet).

If still not working then comment, I come with improved answer ....
Share this answer
YOGESH DHAGE 17-Jan-11 10:44am    
I just done it friend.Thanks
Ashish Tyagi 40 17-Jan-11 11:04am    
my pleasure :)
Ashish Tyagi 40 17-Jan-11 11:05am    
can i just know what changes you made in your code....
First that comes to my mind is: is there a firewall between the server and the clients when you see the problem (if this is P2P -- between the peers)?

So, check up your firewall settings -- first of all, it can be a combination of protocol and port number.
Share this answer
Espen Harlinn 16-Jan-11 18:00pm    
5+ sensible answer :)
Manfred Rudolf Bihy 16-Jan-11 18:03pm     CRLF
Good call! 5+ In a peer to peer situation OP may also need settings for port forwarding on his router/gateway.

First result:
TCP/IP Chat Application Using C#[^]

You spent more time formulating your question, then it took me finding the answer using google.

When you want help with code you are working on, it is usually a good idea to include the problematic section with your question. Then there is an actual chance of receiving the help you need.

@Manfred : That’s why I amended it – your linguistic skills turned it into something more sensible. The code for the article works. If that program works and his doesn’t – he can take a look at the article and maybe it will help him solve his problems. If both fail that will be a fair indication that his problem is not related to his code, it may then be, as SAKryukov points out, network related. (Suddenly I couldn't post comments)

Espen Harlinn
Share this answer
Manfred Rudolf Bihy 16-Jan-11 17:44pm     CRLF
Could it be, Espen, that you are slightly off topic? OP was asking for the cause of the failure when trying to operate his application over the internet as opposed to a LAN where it seems to be working fine.
Sergey Alexandrovich Kryukov 16-Jan-11 17:54pm    
@Espen: I have to agree with Manfred. Your reference is useful though. It could be something else (see my answer).
Sergey Alexandrovich Kryukov 16-Jan-11 18:03pm    
Better now :-)
Espen Harlinn 16-Jan-11 18:09pm    
Thanks :)
Sergey Alexandrovich Kryukov 17-Jan-11 1:14am    
I have no idea why somebody voted "2" for this answer as well as mine. Would be interesting to read some criticizm.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900