TcpListener/TcpClient not working!
-
Hello everyone! I have 2 programs, a server and a client. If I start them both on the same computer, it works flawlessly. However, if I try a computer on the network (which I can do Windows file/printer sharing with) with one of the apps, the client says that the target machine actively refused it. At first I thought it was my router, since I've been having some problems with it lately. But then I used my neighbor's wireless connection with 2 laptops and tried it, no result. So it's got to be my code. Server:
server = new TcpListener(port); // port: 77 server.Start();
Client:
sock = new TcpClient(host, port); // host: 'localhost' or '192.168.0.100'; port: 77
As I said, both programs work fine on the same computer. Does anyone know why this might happen? Maybe my neighbor's router is crappy too? Thanks in advance!
Windows Calculator told me I will die at 28. :(
-
Hello everyone! I have 2 programs, a server and a client. If I start them both on the same computer, it works flawlessly. However, if I try a computer on the network (which I can do Windows file/printer sharing with) with one of the apps, the client says that the target machine actively refused it. At first I thought it was my router, since I've been having some problems with it lately. But then I used my neighbor's wireless connection with 2 laptops and tried it, no result. So it's got to be my code. Server:
server = new TcpListener(port); // port: 77 server.Start();
Client:
sock = new TcpClient(host, port); // host: 'localhost' or '192.168.0.100'; port: 77
As I said, both programs work fine on the same computer. Does anyone know why this might happen? Maybe my neighbor's router is crappy too? Thanks in advance!
Windows Calculator told me I will die at 28. :(
I do not know if this can help.... for your information. 1) you can check your window firewall setting. If your firewall is on,you can set the exception for port 77. 2) To get all the listenning ports at server, you can try 'netstat /a' command at Server command prompt. -- To test the connection from client, you can also try 'telnet [hostIP] [port]' command at Client command prompt. Wish u luck.:) ccwang :)
-
Hello everyone! I have 2 programs, a server and a client. If I start them both on the same computer, it works flawlessly. However, if I try a computer on the network (which I can do Windows file/printer sharing with) with one of the apps, the client says that the target machine actively refused it. At first I thought it was my router, since I've been having some problems with it lately. But then I used my neighbor's wireless connection with 2 laptops and tried it, no result. So it's got to be my code. Server:
server = new TcpListener(port); // port: 77 server.Start();
Client:
sock = new TcpClient(host, port); // host: 'localhost' or '192.168.0.100'; port: 77
As I said, both programs work fine on the same computer. Does anyone know why this might happen? Maybe my neighbor's router is crappy too? Thanks in advance!
Windows Calculator told me I will die at 28. :(
hi this problem faced me before , and after long time i passed it :) go this link and you find a good discussion about it [http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1099091&SiteID=1](http://forums.microsoft.com/MSDN/ShowPost.aspx?
<a href=) i hope it work
-
hi this problem faced me before , and after long time i passed it :) go this link and you find a good discussion about it [http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1099091&SiteID=1](http://forums.microsoft.com/MSDN/ShowPost.aspx?
<a href=) i hope it work
I use the Windows firewall and PeerGuardian. For the Windows one, I clicked 'Unblock' the first time I ran it, and PG doesn't block it. Netstat gives me this: TCP presser:77 presser:0 LISTENING Wait, shouldn't both the local and foreign addresses be the same? Why is one 77 and the other zero? And bola_shokry, that link didn't work. Any more ideas? Thanks you both!
Windows Calculator told me I will die at 28. :(
-
hi this problem faced me before , and after long time i passed it :) go this link and you find a good discussion about it [http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1099091&SiteID=1](http://forums.microsoft.com/MSDN/ShowPost.aspx?
<a href=) i hope it work
sorry , i tryed the link i found it dont work (i dont know why) anyway , go to MSDN Forums » .NET Development » .NET Framework Networking and Communication » problem in client/server application start the navigation from this link: http://forums.microsoft.com/msdn[^] i know this problem , its boring:mad: sorry again
-
sorry , i tryed the link i found it dont work (i dont know why) anyway , go to MSDN Forums » .NET Development » .NET Framework Networking and Communication » problem in client/server application start the navigation from this link: http://forums.microsoft.com/msdn[^] i know this problem , its boring:mad: sorry again
Well, his problem is kind of different. His computers can see each other on a network, mine can't. :-( But I got something here. I disabled both the Windows Firewall and PeerGuardian and guess what, Apache works. I tried my program but nope, that doesn't work yet. But wait a minute... '
telnet 192.168.0.100 77
' gets through! Then how come my client doesn't?! I updated the code:IPEndPoint ep = new IPEndPoint(IPAddress.Parse("192.168.0.100"), 77); sock = new TcpClient(ep);
But it still isn't working... Ideas? Thanks for helping me!
Windows Calculator told me I will die at 28. :(
-
Well, his problem is kind of different. His computers can see each other on a network, mine can't. :-( But I got something here. I disabled both the Windows Firewall and PeerGuardian and guess what, Apache works. I tried my program but nope, that doesn't work yet. But wait a minute... '
telnet 192.168.0.100 77
' gets through! Then how come my client doesn't?! I updated the code:IPEndPoint ep = new IPEndPoint(IPAddress.Parse("192.168.0.100"), 77); sock = new TcpClient(ep);
But it still isn't working... Ideas? Thanks for helping me!
Windows Calculator told me I will die at 28. :(
Nevermind, that wasn't supposed to work. But this is:
sock = new TcpClient(); sock.Client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); sock.Connect(host, 77);
Wee, now I can play in 2 computers. Thanks VERY much! ;)
Windows Calculator told me I will die at 28. :(