I can run the server on my local machine and connect to it on the same machine, but when I try to connect to it from a different computer over the internet, there is not sign of activity on my server, nor a response from the server on the computer I’m testing it on. I’ve tried both XP and Vista, turn off firewalls, opened ports, ran as admin; nothing is working. 🙁
Here is my code that I’m using to accept an incoming connection:
int port = 3326; Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { TcpListener listener = new TcpListener(new IPEndPoint(IPAddress.Any, port)); listener.Start(); Console.WriteLine('Server established\nListening on Port: {0}\n', port); while (true) { socket = listener.AcceptSocket(); socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, outime); socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true); socket.DontFragment = true; NewConnection pxy = new NewConnection(socket); Thread client = new Thread(new ThreadStart(pxy.Start)); client.IsBackground = true; client.Start(); } }
I think that the problem is in your router, not your computer. When packets come from the Internet, it should be routed to an specific server. You have to configure your router to redirect the traffic on port
3326to your server.