[Mono-dev] Can't create a local tcp connection on mono

Ole Bromose ob at dansound.dk
Sat Mar 2 14:56:57 UTC 2013


Hello,

The code below works on Windows. However, when running on mono 2.10.5 on 
Gentoo Linux, the listener throws the exception: 
  System.Net.Sockets.SocketException: The requested address is not valid 
in this context

Listening on the address IPAddress.Any instead of the loopback address 
makes the listener run without exception. However, when the client is 
started, no connection is created (the server eventually times out).

Can anybody explain why I can't create a local connection on mono?

Thanks

Ole

Basically my listener looks like this:

     var listener = new TcpListener(IPAddress.Parse("127.0.0.1"), port);

     listener.Start();

     TcpClient client = listener.AcceptTcpClient();

The client:

      var remoteEP = new IPEndPoint(IPAddress.Parse("127.0.0.1"), port);

      var client = new TcpClient(AddressFamily.InterNetwork);

      client.Connect(remoteEP);


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20130302/9c99e4fe/attachment.html>


More information about the Mono-devel-list mailing list