Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i make sample c# Console application for communication between clients and server using c# socket programming.

communication mean : (in my program the string "hello world" is send by client and server receive and response back to server .)

Clients and Server can communicate with each other when both on same network ,just IP different.

but Clients not sending the string to the server if clients are on other network /Different Network .
e.g think same as now you and me are on different network. i make my pc server and you make your pc client. run my sample {client.cs} exe ,in client.cs there is My server IP include like below:

string serverDNS = "xxx.xx.xx.xx"; // here i put server IP. .
int port = 0;
System.Int32.TryParse("11000", out port);

try
{
IPAddress[] addrs = System.Net.Dns.GetHostAddresses(serverDNS);
foreach (IPAddress addr in addrs)
{
if (addr.AddressFamily == AddressFamily.InterNetwork)
{
endpoint = new IPEndPoint(addr, port);
break;
}
}
}

and i also run on my server pc my sample. in that case i will not able to receive a string "hello worlds" from you (Client pc)>>> this is a problem..
can any body help me please ???

And if in you mind its because of FireWall issue, then tell how can i trace firewall issue ? and also tell me its Clients FireWall issue or Server firewall..and also tell me how to resolve this??
and if due to router then is there any other solution for fix,,without setting router etc ??

Thanks you ..
Posted

1 solution

 
Share this answer
 
Comments
[no name] 26-Nov-14 12:42pm    
There is not any answer of my question
Richard MacCutchan 26-Nov-14 12:47pm    
You have posted this same question more than once. If you have extra information to add then edit the original.
[no name] 27-Nov-14 13:38pm    
why in code project no body can help me in my problem??? i hear that in code project i will easy find out my solution ... :(
Richard MacCutchan 28-Nov-14 3:14am    
A number of people have already tried to help you, and made useful suggestions. If you have a problem then provide a full and clear explanation, including the parts of the code that cause the error, and any error details. Do not assume that we can guess what your code is doing.
[no name] 28-Nov-14 4:48am    
all are just showing me problem ,not giving me solution.. Just saying that i can't connect client with server if they are not on LAn network.firewall will block,this i was also knew too. some saying that need port forwarding for done this job..and after some saying port farwarding can be stop by router too. NAT traversing and upnp . no one giving me a right solution,just telling the problem.and problem i already know.this reason i post my question here. and i am sorry if could not explain my question in well way. but i tried too. Any way i am going to post new Question .i hope i find solution from some one.

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