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.MachineName);
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.Sockets.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?
-----Original Message-----
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 inTIME_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.
--------------------Content-Class: urn:content-classes:message
From: "Tom P" <th***************@boeing.com>
Sender: "Tom P" <th***************@boeing.com>
References: <OI**************@TK2MSFTNGP09.phx.gbl>
<qL**************@cpmsftngxa06.phx.gbl>Subject: RE: Error from Dns.GetHostName
Date: Sat, 23 Aug 2003 09:56:43 -0700
It happens immediately. I checked it right after a
freshreboot, but after getting connected to the internet.
I'musing 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-----Original Message-----
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 doesit happen immediately (right when you start it)?
Also, after you get the error, please run "netstat -a"
from the commandline and see if you have a bunch of TCP ports that have
aState 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,
andconfers no rights.Please reply to newsgroups only, so that others may
benefit. Thanks.
--------------------
From: "MSNews" <th***************@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.Sockets.SocketException'occurred
in system.dll
Additional information: An operation on a socket could
not be performedbecause the system lacked sufficient buffer space or
because a queue wasfull
This exception is then followed with the following
exception:An unhandled exception of
type 'System.TypeInitializationException'occurred
in system.dll
Additional information: The type initializer for
"System.Net.Sockets.Socket"
threw an exception.
I'm running .net Framework1.1 on Win2k, on a laptop
witha couple ofnetwork adapters. I did some experiments to limit
numbers of processesrunning, stopped sql server etc... I removed the
Netbeuiprotocol from theadapter that is connected to the internet etc. I had
some success withthis
approach... the error disappeared for a couple of
days,but is now back.
Any suggestions?
.
.