Role of ports in sockets
-
Hi, I am working on a chatting project witch is to work using C# Sockets. There are two segments "Server" and "Client" as usual. I tried it on a local network and the result is with 5 systems in my lab, it is working nicely and on making a system Client and any one Server , we became able to have our conversations but with rest of two systems story is not same. When I am making my PC server and another one client , it is working but when I am keeping Client and making other one server it is not working and generating following exceptions: "A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond + C# socket program" If it is working with other PC of the LAB nicely than why it is not working with only 2 PCs. Structure is as : Server picks IP and port of the system on which it is running that is like : IP : 192.168.0.13 Port: 8000 On the Client PC We need to give IP of our Server and a port number, that is like IP : 192.168.0.13 Port : 8000 Can any one tell me why is this happening . Hemant S. Adhikari
-
Hi, I am working on a chatting project witch is to work using C# Sockets. There are two segments "Server" and "Client" as usual. I tried it on a local network and the result is with 5 systems in my lab, it is working nicely and on making a system Client and any one Server , we became able to have our conversations but with rest of two systems story is not same. When I am making my PC server and another one client , it is working but when I am keeping Client and making other one server it is not working and generating following exceptions: "A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond + C# socket program" If it is working with other PC of the LAB nicely than why it is not working with only 2 PCs. Structure is as : Server picks IP and port of the system on which it is running that is like : IP : 192.168.0.13 Port: 8000 On the Client PC We need to give IP of our Server and a port number, that is like IP : 192.168.0.13 Port : 8000 Can any one tell me why is this happening . Hemant S. Adhikari
Is there a firewall in place? Are the two PCs on the same network? The IP addresses given are on an internal range so if the connection crosses the internet it won't work, you need an external IP address.
Developer Day Scotland 2 - Free community conference Recent blog posts: *Throwing Exceptions *Training Developers * Method hiding or overriding - or the difference between new and virtual
-
Hi, I am working on a chatting project witch is to work using C# Sockets. There are two segments "Server" and "Client" as usual. I tried it on a local network and the result is with 5 systems in my lab, it is working nicely and on making a system Client and any one Server , we became able to have our conversations but with rest of two systems story is not same. When I am making my PC server and another one client , it is working but when I am keeping Client and making other one server it is not working and generating following exceptions: "A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond + C# socket program" If it is working with other PC of the LAB nicely than why it is not working with only 2 PCs. Structure is as : Server picks IP and port of the system on which it is running that is like : IP : 192.168.0.13 Port: 8000 On the Client PC We need to give IP of our Server and a port number, that is like IP : 192.168.0.13 Port : 8000 Can any one tell me why is this happening . Hemant S. Adhikari
Can you post the code that you have? If not, you can check out the code on this page (http://msdn.microsoft.com/en-us/library/w89fhyex.aspx). I would advise going through this page first. It provides good, working examples of client server sockets. Hope this helps :), Prateek