+
+#if NET_2_0
+ internal bool CallEndPointDelegate (Socket sock, IPEndPoint remote)
+ {
+ if (endPointCallback == null)
+ return true;
+
+ int count = 0;
+ for (;;) {
+ IPEndPoint local = null;
+ try {
+ local = endPointCallback (this,
+ remote, count);
+ } catch {
+ // This is to differentiate from an
+ // OverflowException, which should propagate.
+ return false;
+ }
+
+ if (local == null)
+ return true;
+
+ try {
+ sock.Bind (local);
+ } catch (SocketException) {
+ // This is intentional; the docs say
+ // that if the Bind fails, we keep
+ // going until there is an
+ // OverflowException on the retry
+ // count.
+ checked { ++count; }
+ continue;
+ }
+
+ return true;
+ }
+ }
+#endif