2 // Microsoft.Web.Services.Messaging.SoapTcpListener.cs
4 // Author: Todd Berman <tberman@gentoo.org>
6 // (C) 2003 Todd Berman
10 using System.Net.Sockets;
12 namespace Microsoft.Web.Services.Messaging
14 public class SoapTcpListener : TcpListener
17 private int _refs = 0;
19 private delegate Socket AcceptSock ();
21 private AcceptSock _acceptSocket;
23 public SoapTcpListener (IPEndPoint endpoint) : base (endpoint)
26 Server.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, true);
30 public SoapTcpListener (IPAddress address, int port) : base (address, port)
33 Server.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, true);
37 public SoapTcpListener (int port) : base (port)
40 Server.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, true);
44 public void AddReference ()
49 public int ReleaseReference ()
54 public IAsyncResult BeginAcceptSocket (AsyncCallback callback, object state)
56 if(_acceptSocket == null) {
57 _acceptSocket = new AcceptSock (base.AcceptSocket);
59 return _acceptSocket.BeginInvoke (callback, state);
62 public Socket EndAcceptSocket (IAsyncResult result)
64 return _acceptSocket.EndInvoke (result);
67 public bool IsListening {
68 get { return Active; }