Error from Dns.GetHostName

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MSNews

    Error from Dns.GetHostName

    I get the following exception when calling Dns.GetHostName (from C#):
    An unhandled exception of type 'System.Net.Soc kets.SocketExce ption' occurred
    in system.dll
    Additional information: An operation on a socket could not be performed
    because the system lacked sufficient buffer space or because a queue was
    full

    This exception is then followed with the following exception:
    An unhandled exception of type 'System.TypeIni tializationExce ption' occurred
    in system.dll
    Additional information: The type initializer for "System.Net.Soc kets.Socket"
    threw an exception.

    I'm running .net Framework1.1 on Win2k, on a laptop with a couple of
    network adapters. I did some experiments to limit numbers of processes
    running, stopped sql server etc... I removed the Netbeui protocol from the
    adapter that is connected to the internet etc. I had some success with this
    approach... the error disappeared for a couple of days, but is now back.

    Any suggestions?


  • Jim Blizzard [MSFT]

    #2
    RE: Error from Dns.GetHostName

    Thomas,

    I've seen something similar to what you're describing.

    Does this happen when you run your program for some period of time or does
    it happen immediately (right when you start it)?

    Also, after you get the error, please run "netstat -a" from the command
    line and see if you have a bunch of TCP ports that have a State of
    "TIME_WAIT" .

    Thanks,
    bliz

    --
    Jim Blizzard | http://weblogs.asp.net/jblizzard
    Sr .NET Developer Evangelist
    Microsoft

    Your Potential. Our Passion.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Please reply to newsgroups only, so that others may benefit. Thanks.


    --------------------[color=blue]
    >From: "MSNews" <thomas.w.pastu sak@boeing.com>
    >Subject: Error from Dns.GetHostName
    >Date: Fri, 22 Aug 2003 14:30:52 -0700
    >
    >I get the following exception when calling Dns.GetHostName (from C#):
    >An unhandled exception of type 'System.Net.Soc kets.SocketExce ption'[/color]
    occurred[color=blue]
    >in system.dll
    >Additional information: An operation on a socket could not be performed
    >because the system lacked sufficient buffer space or because a queue was
    >full
    >
    >This exception is then followed with the following exception:
    >An unhandled exception of type 'System.TypeIni tializationExce ption'[/color]
    occurred[color=blue]
    >in system.dll
    >Additional information: The type initializer for[/color]
    "System.Net.Soc kets.Socket"[color=blue]
    >threw an exception.
    >
    >I'm running .net Framework1.1 on Win2k, on a laptop with a couple of
    >network adapters. I did some experiments to limit numbers of processes
    >running, stopped sql server etc... I removed the Netbeui protocol from the
    >adapter that is connected to the internet etc. I had some success with[/color]
    this[color=blue]
    >approach... the error disappeared for a couple of days, but is now back.
    >
    >Any suggestions?
    >
    >
    >[/color]

    Comment

    • Jim Blizzard [MSFT]

      #3
      RE: Error from Dns.GetHostName

      Hmmmm. The case I had occured after the program had been running for 30+
      hours. It wasn't an immediate thing. There were 100s of ports open in
      TIME_WAIT state when it finally failed.

      Do you have some simple code you could post that reproduces the problem?

      --
      Jim Blizzard | http://weblogs.asp.net/jblizzard
      Sr .NET Developer Evangelist
      Microsoft

      Your Potential. Our Passion.

      This posting is provided "AS IS" with no warranties, and confers no rights.
      Please reply to newsgroups only, so that others may benefit. Thanks.


      --------------------[color=blue]
      >Content-Class: urn:content-classes:message
      >From: "Tom P" <thomas.w.pastu sak@boeing.com>
      >Sender: "Tom P" <thomas.w.pastu sak@boeing.com>
      >References: <OIpcrSPaDHA.18 32@TK2MSFTNGP09 .phx.gbl>[/color]
      <qLmXQAVaDHA.21 16@cpmsftngxa06 .phx.gbl>[color=blue]
      >Subject: RE: Error from Dns.GetHostName
      >Date: Sat, 23 Aug 2003 09:56:43 -0700
      >
      >It happens immediately. I checked it right after a fresh
      >reboot, but after getting connected to the internet. I'm
      >using IPSEC to establish a tunnel into the Boeing intranet.
      >The error also occurs when connect inside the Boeing
      >intranet (while I'm at work vs at home).
      >
      >Yes, there are several (20) channels in TIME_WAIT state.
      >
      >There are between 40 and 50 channels that show up in the
      >status list.
      >
      >Thanks for your help.
      >
      >Tom[color=green]
      >>-----Original Message-----
      >>Thomas,
      >>
      >>I've seen something similar to what you're describing.
      >>
      >>Does this happen when you run your program for some[/color]
      >period of time or does[color=green]
      >>it happen immediately (right when you start it)?
      >>
      >>Also, after you get the error, please run "netstat -a"[/color]
      >from the command[color=green]
      >>line and see if you have a bunch of TCP ports that have a[/color]
      >State of[color=green]
      >>"TIME_WAIT" .
      >>
      >>Thanks,
      >>bliz
      >>
      >>--
      >>Jim Blizzard | http://weblogs.asp.net/jblizzard
      >>Sr .NET Developer Evangelist
      >>Microsoft
      >>
      >>Your Potential. Our Passion.
      >>
      >>This posting is provided "AS IS" with no warranties, and[/color]
      >confers no rights.[color=green]
      >>Please reply to newsgroups only, so that others may[/color]
      >benefit. Thanks.[color=green]
      >>
      >>
      >>--------------------[color=darkred]
      >>>From: "MSNews" <thomas.w.pastu sak@boeing.com>
      >>>Subject: Error from Dns.GetHostName
      >>>Date: Fri, 22 Aug 2003 14:30:52 -0700
      >>>
      >>>I get the following exception when calling[/color][/color]
      >Dns.GetHostNam e (from C#):[color=green][color=darkred]
      >>>An unhandled exception of[/color][/color]
      >type 'System.Net.Soc kets.SocketExce ption'[color=green]
      >>occurred[color=darkred]
      >>>in system.dll
      >>>Additional information: An operation on a socket could[/color][/color]
      >not be performed[color=green][color=darkred]
      >>>because the system lacked sufficient buffer space or[/color][/color]
      >because a queue was[color=green][color=darkred]
      >>>full
      >>>
      >>>This exception is then followed with the following[/color][/color]
      >exception:[color=green][color=darkred]
      >>>An unhandled exception of[/color][/color]
      >type 'System.TypeIni tializationExce ption'[color=green]
      >>occurred[color=darkred]
      >>>in system.dll
      >>>Additional information: The type initializer for[/color]
      >>"System.Net.S ockets.Socket"[color=darkred]
      >>>threw an exception.
      >>>
      >>>I'm running .net Framework1.1 on Win2k, on a laptop with[/color][/color]
      >a couple of[color=green][color=darkred]
      >>>network adapters. I did some experiments to limit[/color][/color]
      >numbers of processes[color=green][color=darkred]
      >>>running, stopped sql server etc... I removed the Netbeui[/color][/color]
      >protocol from the[color=green][color=darkred]
      >>>adapter that is connected to the internet etc. I had[/color][/color]
      >some success with[color=green]
      >>this[color=darkred]
      >>>approach.. . the error disappeared for a couple of days,[/color][/color]
      >but is now back.[color=green][color=darkred]
      >>>
      >>>Any suggestions?
      >>>
      >>>
      >>>[/color]
      >>
      >>.
      >>[/color]
      >[/color]

      Comment

      • Tom Pastusak

        #4
        RE: Error from Dns.GetHostName

        I created the simplest of windows forms app, and put a
        call to Dns.GetHostName (); in the constructor:
        In form1 constructor:
        Dns.GetHostName ();

        I tried some variations
        IPHostEntry host = Dns.Resolve
        (Environment.Ma chineName);

        In fact, any static method on Dns will give the same
        result. It appears to me that the static initializers in
        Dns are failing, because if I catch the exception and then
        follow up with another call to any Dns static, I get
        slightly different behaviour in that the debugger doesn't
        report an "uncaught exception in System.dll", but does
        report the final exception:
        The type initializer for "System.Net.Soc kets.Socket" threw
        an exception.

        In my latest test, there were 0 sockets in the TIME_WAIT
        state. There were a total of about 20 TCP sockets listed
        in netstat -a. There were about 20 UDP sockets as well.

        This result may indicate that there is something peculiar
        with my system environment... combination of types of
        devices/drivers and protocols that may be tripping up the
        Dns initializer? One device I have installed is a Linksys
        Combo PCMCIA Ethernet Adapter. I run NetBEUI to
        communicate with a shop floor device on 10-baseT.
        However, as an experiment, I tried disabling the device
        and removing it from my system, and this did not clear up
        the problem. Early last week, I had a positive result
        with both network devices plugged in and communicating.

        Could it be that plug-and-play, with the way in which
        adapter numbers are not pre-determined may have laid out
        the adapter order in a different sequence, and this leads
        to pseudo-random failures?
        [color=blue]
        >-----Original Message-----
        >Hmmmm. The case I had occured after the program had been[/color]
        running for 30+[color=blue]
        >hours. It wasn't an immediate thing. There were 100s of[/color]
        ports open in[color=blue]
        >TIME_WAIT state when it finally failed.
        >
        >Do you have some simple code you could post that[/color]
        reproduces the problem?[color=blue]
        >
        >--
        >Jim Blizzard | http://weblogs.asp.net/jblizzard
        >Sr .NET Developer Evangelist
        >Microsoft
        >
        >Your Potential. Our Passion.
        >
        >This posting is provided "AS IS" with no warranties, and[/color]
        confers no rights.[color=blue]
        >Please reply to newsgroups only, so that others may[/color]
        benefit. Thanks.[color=blue]
        >
        >
        >--------------------[color=green]
        >>Content-Class: urn:content-classes:message
        >>From: "Tom P" <thomas.w.pastu sak@boeing.com>
        >>Sender: "Tom P" <thomas.w.pastu sak@boeing.com>
        >>References: <OIpcrSPaDHA.18 32@TK2MSFTNGP09 .phx.gbl>[/color]
        ><qLmXQAVaDHA.2 116@cpmsftngxa0 6.phx.gbl>[color=green]
        >>Subject: RE: Error from Dns.GetHostName
        >>Date: Sat, 23 Aug 2003 09:56:43 -0700
        >>
        >>It happens immediately. I checked it right after a[/color][/color]
        fresh[color=blue][color=green]
        >>reboot, but after getting connected to the internet.[/color][/color]
        I'm[color=blue][color=green]
        >>using IPSEC to establish a tunnel into the Boeing[/color][/color]
        intranet.[color=blue][color=green]
        >>The error also occurs when connect inside the Boeing
        >>intranet (while I'm at work vs at home).
        >>
        >>Yes, there are several (20) channels in TIME_WAIT state.
        >>
        >>There are between 40 and 50 channels that show up in the
        >>status list.
        >>
        >>Thanks for your help.
        >>
        >>Tom[color=darkred]
        >>>-----Original Message-----
        >>>Thomas,
        >>>
        >>>I've seen something similar to what you're describing.
        >>>
        >>>Does this happen when you run your program for some[/color]
        >>period of time or does[color=darkred]
        >>>it happen immediately (right when you start it)?
        >>>
        >>>Also, after you get the error, please run "netstat -a"[/color]
        >>from the command[color=darkred]
        >>>line and see if you have a bunch of TCP ports that have[/color][/color][/color]
        a[color=blue][color=green]
        >>State of[color=darkred]
        >>>"TIME_WAIT ".
        >>>
        >>>Thanks,
        >>>bliz
        >>>
        >>>--
        >>>Jim Blizzard | http://weblogs.asp.net/jblizzard
        >>>Sr .NET Developer Evangelist
        >>>Microsoft
        >>>
        >>>Your Potential. Our Passion.
        >>>
        >>>This posting is provided "AS IS" with no warranties,[/color][/color][/color]
        and[color=blue][color=green]
        >>confers no rights.[color=darkred]
        >>>Please reply to newsgroups only, so that others may[/color]
        >>benefit. Thanks.[color=darkred]
        >>>
        >>>
        >>>--------------------
        >>>>From: "MSNews" <thomas.w.pastu sak@boeing.com>
        >>>>Subject: Error from Dns.GetHostName
        >>>>Date: Fri, 22 Aug 2003 14:30:52 -0700
        >>>>
        >>>>I get the following exception when calling[/color]
        >>Dns.GetHostNa me (from C#):[color=darkred]
        >>>>An unhandled exception of[/color]
        >>type 'System.Net.Soc kets.SocketExce ption'[color=darkred]
        >>>occurred
        >>>>in system.dll
        >>>>Additiona l information: An operation on a socket could[/color]
        >>not be performed[color=darkred]
        >>>>because the system lacked sufficient buffer space or[/color]
        >>because a queue was[color=darkred]
        >>>>full
        >>>>
        >>>>This exception is then followed with the following[/color]
        >>exception:[color=darkred]
        >>>>An unhandled exception of[/color]
        >>type 'System.TypeIni tializationExce ption'[color=darkred]
        >>>occurred
        >>>>in system.dll
        >>>>Additiona l information: The type initializer for
        >>>"System.Net. Sockets.Socket"
        >>>>threw an exception.
        >>>>
        >>>>I'm running .net Framework1.1 on Win2k, on a laptop[/color][/color][/color]
        with[color=blue][color=green]
        >>a couple of[color=darkred]
        >>>>network adapters. I did some experiments to limit[/color]
        >>numbers of processes[color=darkred]
        >>>>running, stopped sql server etc... I removed the[/color][/color][/color]
        Netbeui[color=blue][color=green]
        >>protocol from the[color=darkred]
        >>>>adapter that is connected to the internet etc. I had[/color]
        >>some success with[color=darkred]
        >>>this
        >>>>approach. .. the error disappeared for a couple of[/color][/color][/color]
        days,[color=blue][color=green]
        >>but is now back.[color=darkred]
        >>>>
        >>>>Any suggestions?
        >>>>
        >>>>
        >>>>
        >>>
        >>>.
        >>>[/color]
        >>[/color]
        >
        >.
        >[/color]

        Comment

        Working...