System.Net.Sockets.SocketException:Could not find resource assembly RRS feed

  • Question

  • Hi everyone,

    I have developped a small app for ipaq, windows ce (for which I have installed .Net Compact Framework runtime SP2). The app is very simple, it connects to a url via System.Net.Sockets.TcpClient and retrieves a html web page.

    Strangely enough, it works on the Emulator however when I deploy it on the ipaq, I get:

    System.Net.Sockets.SocketException:Could not find resource assembly


    Could not find resource assembly
    Dns:GetHostBy Address+0x63

    Is something missing, not installed, on the ipaq? (internet connection is working, etc)

    Thursday, August 4, 2005 2:01 PM


All replies

  • The "Could not find resource assembly" bit indicates that you have not deployed System.SR assembly that contains the exception descriptions.

    It gives you the name of the method that failed: Dns.GetHostByAddress so look it up:

    You can see what exceptions the method can throw and you actually know that you have a SocketException so, reading the documentation: "An error was encountered when resolving the address".

    At this point, whether you are calling that method directly or whether it is called as a result of other call you make, the best thing is to show us some code and make sure that whatever address you are passing to TcpClient is reachable.

    You can help yourself by catching the SocketException and querying its other helpful properties:

    Just fyi, if you browse the netcf assembly which contains the Dns class and have a look at the IL for the method in question (using ILDASM or Reflector etc) then you can go to the line 0x63 and then you'll see that it is the call to the native getgostbyaddr that returned null.

    Thursday, August 4, 2005 2:19 PM
  • Thanks for your answer, I will give it a try

    Thursday, August 4, 2005 2:33 PM
  • Ok, still getting error and it is strange

    Here is the code I'm using



    string hostname = "";

    TcpClient client = new TcpClient(hostname, 80);

    NetworkStream stream = client.GetStream();

    String HttpHeader = String.Format("GET http://{0} HTTP/1.1\r\nHost: {0}\r\n Connection: close\r\n\r\n", hostname);

    stream.Write(Encoding.ASCII.GetBytes(HttpHeader), 0, HttpHeader.Length);

    byte[] buffer = new byte[10000];

    int nRead = stream.Read(buffer, 0, 10000);


    System.Windows.Forms.MessageBox.Show(Encoding.ASCII.GetString(buffer, 0, nRead));


    catch(Exception exc)




    If i run the above code with the dotted decimal address, it gives me a SocketException

    If I replace hostname = www.google.com, it works nicely, returning me the HTTP 200 OK response

    Any ideas on this one ?

    Regards, radu

    Friday, August 5, 2005 8:36 AM
  • Ok, problem solved !

    Dns.Resolve works for urls, IPAddress.Parse will convert dotted decimal to an IPAddress

    Thanks to all that read and answered this one,
    Friday, August 5, 2005 9:09 AM
  • I had the very same problem, although I was parsing my IP address correctly.

    The 'could not fine the resource' was in my error logs.

    Was thoroughly puzzled until as it could not find the IP still.

    The fix was to define an IPEndPoint


    '' VB Code Below----------------------------------

    Dim client As Net.Sockets.TcpClient

    Dim ipend As New System.Net.IPEndPoint(System.Net.IPAddress.Parse("192.1`68.0.10"), 80)

    client = New Net.Sockets.TcpClient



    Regards,  Keith.


    Friday, July 29, 2011 9:05 AM