Women in Technology

Hear us Roar



Article:
  Client/Server Rendezvous on the LAN
Subject:   Update for .NET v1.1
Date:   2003-07-16 22:34:17
From:   arithex
To workaround the unhandled SocketException crash on the client-side, when running under the v1.1 runtime, uncomment the two lines in UdpRendezvous.cs which handle the SocketException (lines 331-332).


Explanation: Although this exception behavior has been documented since v1.0 days, in practice I found that v1.0's UdpClient.Receive() would throw an ObjectDisposedException, instead. I commented out the SocketException handler, so we would all be alerted to this change/fix, if it ever happened. Guess what? It happened!


Also note: the IPAddress.Address property is officially deprecated in v1.1, and you'll see a handful of compiler warnings alerting you to this fact. (The Address property attempts to represent the IP address as an Int64 value, but IPv6 uses an address space of 128 bits.) My code used the Address property merely as an optimization for comparing/hashing the HostResponse structure. It was not necessary -- changing the code to avoid the warnings is trivial.


Updated .zip file for Visual Studio 2003 and .NET v1.1 can be found here:
http://arithex.com/UdpRendezvous.zip


Cheers,
-S