[Mono-list] System.Net.Sockets.Socket::Connect()

Jonathan Stowe gellyfish@gellyfish.com
Tue, 14 May 2002 09:57:12 +0100 (BST)


I'll bugzilla this but I'm not sure where the problem lies.  Previously
working code of the sort :

using System;
using System.Net;
using System.Net.Sockets;

class SockTest
{

   public static void Main()
   {

    IPEndPoint EPhost;
    try
    {
       IPHostEntry host = Dns.Resolve("localhost");
       IPAddress[] addresses = host.AddressList;

       IPAddress hostadd = addresses[0];
       EPhost = new IPEndPoint(hostadd, 80);
    }
    catch (Exception e)
    {
       Console.WriteLine(e.ToString());
    }
    Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
       ProtocolType.Tcp );


    try
    {
      s.Connect(EPhost);
    }
    catch(Exception e)
    {
        Console.WriteLine(EPhost);
        Console.WriteLine(e.ToString());
    }
  }
}

No longer works.  Sometimes it just appears to hang and sometimes I get


(process:12242): ** WARNING **: _wapi_connect: Need to translate [No route
to host] into winsock error
Message:
ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal:
returning 0
127.0.0.1:80
System.Net.Sockets.SocketException
Some sort of w32 error occurredSystem.Net.Sockets.SocketExceptionTODO:
implement stack traces


I have confirmed that the host is accessible by other means.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |