Intermittent Socket Exception



Hello everyone,

i have a windows services (framework 1.1) that uses a socket to send
Multicast UDP Datagrams. On one particular server (HP with Windows 2003
x64), sometimes i get an exception:

SocketException: The requested address is not valid in its context.

I believe the offending lines are this ones:

UdpSender = New Socket(AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp)
UdpSender.Bind(New IPEndPoint(LocalAddress, LocalPort))

I know that exception is raised when you use an invalid IP/Port, the problem
is that I checked that LocalAddress and LocalIP are ALWAYS the same, but
sometimes i get the exception. Also we suspect this problem is causing a
memory leak...

Any idea?

TIA
Paolo


.



Relevant Pages

  • Intermittent socket exception
    ... i have a windows services that uses a socket to send ... x64), ... I know that exception is raised when you use an invalid IP/Port, ...
    (microsoft.public.dotnet.framework)
  • Re: Intermittent Socket Exception
    ... i have a windows services (framework 1.1) that uses a socket to send ... I know that exception is raised when you use an invalid IP/Port, ...
    (microsoft.public.win32.programmer.networks)
  • Re: An existing connection was forcibly closed by the remote host...
    ... EndReceivewill throw "Can't access disposed object" exception whenever the connection is terminated. ... In MS .NET Socket implementation there is no mechanism for the socket object to signal to the main thread that it is about to be disposed. ... public Socket ClientSocket ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: "invalid handle", sockets, threads and garbage collector
    ... your IntPtr value happens to coincide with a reference. ... The exception contains "invalid handle" message. ... Socket constructor problem ... finalization means closing the handle to resource. ...
    (microsoft.public.dotnet.framework.clr)
  • "invalid handle", sockets, threads and garbage collector
    ... The exception contains "invalid handle" message. ... Socket constructor problem ... finalization means closing the handle to resource. ...
    (microsoft.public.dotnet.framework.clr)