Vista is blocking incomming networkCommunication (such as tcpListener)
-
I cannot get TcpListener working under vista (i have the same problem with WCF communication but the example with tcp listener is easier to demonstrate). The following example works when: -Server and client are on the same vista or winxp machine -Server is on winxp and client is on vista the following example doesn't work (and i need it to work) when: -Server is on vista, client is on another machine (vista or winxp) ps:My networking is ok, i can ping the server on vista, all possible firewall stuff is off (i even added the port in the disabled firewall to pass) . As I mentioned before, if i create a wcf application i have the same problem.I hope someone can help me. This is my server:
static void Main(string[] args) { //Create a TCP/IP socket. SocketPermission permission = new SocketPermission(NetworkAccess.Accept,TransportType.All,"192.168.2.69",8075); permission.Demand(); TcpListener listener = new TcpListener(IPAddress.Parse("192.168.2.69"), 8075);//yes, i also tried IPAddress.Any listener.Start(); TcpClient client=listener.AcceptTcpClient(); StreamReader reader = new StreamReader(client.GetStream()); string data=""; do{ data = reader.ReadLine(); Console.WriteLine(data); }while (data!="end"); }
This is my client:static void Main(string[] args) { TcpClient client = new TcpClient(); client.Connect("192.168.2.69", 8075);//block here StreamWriter writer=new StreamWriter(client.GetStream()); writer.AutoFlush = true; writer.WriteLine("Hello"); writer.WriteLine("end"); }