Advertisement

C# TcpListener connection problem

Started by January 25, 2006 06:14 AM
1 comment, last by GameDev.net 19 years ago
Ive had some problems getting the TcpListener under C# to find and accept connections from a client with my client app and/or a simple telnet connection. Connecting locally (localhost / 127.0.0.1) works fine but externally does not. First i thought that it must be a firewall that was refusing the connections, but even with it shut off (on both the server and client) i still cant get it to connect. Has anyone had the same problem and if so, what should i do to fix it? Im using WinXP Pro, .NET 1.1 and VS 2003. Heres a simplified version of how i setup the tcp listener on the server: // Initialize the tcp listener for connection clients TcpListener tcpServerListener = new TcpListener(IPAddress.Any, 8002); // Start the tcp listener tcpServerListener.Start(); // Wait for an incomming connection from a client Socket socket = tcpServerListener.AcceptSocket(); // Handle the connected client here
are you behind a router?

If so, you wanna open up that port and tell it to go to your machine.

This topic is closed to new replies.

Advertisement