Provide methods for TCP/IP communication through the various types of proxies.
SocketEx class built on top of the System.Net.Sockets.Socket class provided by the .NET Framework. The main advantages of the SocketEx class is that it might be used to communicate with the peer host through the various types of proxies. Thus giving your application the simple way to add so called 'firewall friendly features'.

Following proxy servers are supported: Socks4 Socks4a Socks5, username/password authentication method supported Web proxy (HTTP CONNECT method), basic authentication method supported

상속: IDisposable
 public NetworkStreamEx(SocketEx socket, FileAccess access)
 {
     this._asyncCtx = new AsyncBase();
     this._access   = FileAccess.ReadWrite;
     this._socket   = socket;
     this._access   = access;
 }
 public NetworkStreamEx(SocketEx socket, bool ownsSocket)
 {
     this._asyncCtx   = new AsyncBase();
     this._access     = FileAccess.ReadWrite;
     this._socket     = socket;
     this._ownsSocket = ownsSocket;
 }
예제 #3
0
 /// <summary>
 /// Creates the network stream for the <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// with the specified ownership.
 /// </summary>
 /// <param name="socket">
 /// The
 /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// that the
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// will use to send and receive data over network.
 /// </param>
 /// <param name="ownsSocket">
 /// <b>true</b> to indicate that the
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// will take ownership of the <see cref="BytesRoad.Net.Sockets.SocketEx"/>; otherwise, <b>false</b>.
 /// </param>
 /// <remarks>
 /// The
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// is created with read/write access to the specified
 /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>.
 /// If <i>ownsSocket</i> is <b>true</b>, the <b>NetworkStreamEx</b> takes ownership of the
 /// underlying <see cref="BytesRoad.Net.Sockets.SocketEx"/>,
 /// and calling the NetworkStreamEx's
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.Close"/>
 /// method will also close the underlying <b>SocketEx</b>.
 /// </remarks>
 /// <exception cref="System.ArgumentNullException">
 /// <i>socket</i> is null reference (<b>Nothing</b> in Visual Basic).
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// specified <i>socket</i> is not connected.
 /// </exception>
 public NetworkStreamEx(SocketEx socket, bool ownsSocket)
 {
     _socket     = socket;
     _ownsSocket = ownsSocket;
 }
예제 #4
0
 /// <overloads>
 /// Create an instance of the <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/> class.
 /// </overloads>
 /// <summary>
 /// Creates the network stream for the specified <see cref="BytesRoad.Net.Sockets.SocketEx"/>.
 /// </summary>
 /// <param name="socket">
 /// The
 /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// that the
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// will use to send and receive data over network.
 /// </param>
 /// <remarks>
 /// The
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// is created with read/write access to the specified
 /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>.
 /// The <b>NetworkStreamEx</b> does not own the underlying <b>SocketEx</b>, so calling the
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.Close"/> method will not
 /// close the <b>SocketEx</b>.
 /// </remarks>
 /// <exception cref="System.ArgumentNullException">
 /// <i>socket</i> is null reference (<b>Nothing</b> in Visual Basic).
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// specified <i>socket</i> is not connected.
 /// </exception>
 public NetworkStreamEx(SocketEx socket)
 {
     _socket = socket;
 }
예제 #5
0
        internal SocketEx createSocket()
        {
            // create SocketEx object according to proxy settings
            SocketEx sock = null;
            try
            {
                sock = new SocketEx(currentProxy.ProxyType, currentProxy.ProxyServer, currentProxy.ProxyPort, currentProxy.ProxyUser, currentProxy.ProxyPassword);
                sock.SetTimeout(0x30d40);
            }
            catch (Exception sockError)
            {
                AddLogLine("createSocket error: " + sockError.Message);
            }

            return sock;
        }
예제 #6
0
 /// <summary>
 /// Creates the network stream for the <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// with the specified access rights and ownership.
 /// </summary>
 /// <param name="socket">
 /// The 
 /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// that the 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/> 
 /// will use to send and receive data over network.
 /// </param>
 /// <param name="access">
 /// A bitwise combination of the 
 /// <see cref="System.IO.FileAccess"/>
 /// values, specifying the type of access given to the 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// over the provided <see cref="BytesRoad.Net.Sockets.SocketEx"/>.
 /// </param>
 /// <param name="ownsSocket">
 /// <b>true</b> to indicate that the 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// will take ownership of the <see cref="BytesRoad.Net.Sockets.SocketEx"/>; otherwise, <b>false</b>.
 /// </param>
 /// <remarks>
 ///  If <i>ownsSocket</i> is <b>true</b>, the <b>NetworkStreamEx</b> takes ownership of the 
 /// underlying <see cref="BytesRoad.Net.Sockets.SocketEx"/>, and calling the NetworkStreamEx's 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.Close"/>
 /// method will also close the underlying <b>SocketEx</b>.
 /// <para>
 /// The <i>access</i> parameter sets the 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.CanRead"/> and 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.CanWrite"/> 
 /// properties of the <b>NetworkStreamEx</b>.
 /// If you specify <see cref="System.IO.FileAccess.Write"/>, then the <b>NetworkStreamEx</b> will 
 /// allow writing operations only. If you specify 
 /// <see cref="System.IO.FileAccess.Read"/>, then the <b>NetworkStreamEx</b> will allow read operations only. 
 /// If you specify <see cref="System.IO.FileAccess.ReadWrite"/>, both types of operations will be allowed.
 /// </para>
 /// 
 /// </remarks>
 /// <exception cref="System.ArgumentNullException">
 /// <i>socket</i> is null reference (<b>Nothing</b> in Visual Basic).
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// specified <i>socket</i> is not connected.
 /// </exception>
 public NetworkStreamEx(SocketEx socket, FileAccess access, bool ownsSocket)
 {
     _socket = socket;
     _ownsSocket = ownsSocket;
     _access = access;
 }
예제 #7
0
 /// <summary>
 /// Creates the network stream for the <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// with the specified access rights.
 /// </summary>
 /// <param name="socket">
 /// The 
 /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// that the 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/> 
 /// will use to send and receive data over network.
 /// </param>
 /// <param name="access">
 /// A bitwise combination of the 
 /// <see cref="System.IO.FileAccess"/>
 /// values, specifying the type of access given to the 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// over the provided <see cref="BytesRoad.Net.Sockets.SocketEx"/>.
 /// </param>
 /// <remarks>
 /// When <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/> created with this constructor,
 /// it does not own the underlying <see cref="BytesRoad.Net.Sockets.SocketEx"/>, 
 /// so calling the NetworkStreamEx's 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.Close"/> 
 /// method will not close the underlying <b>SocketEx</b>.
 /// <para>
 /// The <i>access</i> parameter sets the 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.CanRead"/> and 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.CanWrite"/> 
 /// properties of the <b>NetworkStreamEx</b>.
 /// If you specify <see cref="System.IO.FileAccess.Write"/>, then the <b>NetworkStreamEx</b> will 
 /// allow writing operations only. If you specify 
 /// <see cref="System.IO.FileAccess.Read"/>, then the <b>NetworkStreamEx</b> will allow read operations only. 
 /// If you specify <see cref="System.IO.FileAccess.ReadWrite"/>, both types of operations will be allowed.
 /// </para>
 /// </remarks>
 /// <exception cref="System.ArgumentNullException">
 /// <i>socket</i> is null reference (<b>Nothing</b> in Visual Basic).
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// specified <i>socket</i> is not connected.
 /// </exception>
 public NetworkStreamEx(SocketEx socket, FileAccess access)
 {
     _socket = socket;
     _access = access;
 }
예제 #8
0
 internal Bind_Op(SocketBase baseSocket, SocketEx primConnSock)
 {
     _baseSocket = baseSocket;
     _primConnSock = primConnSock;
 }
예제 #9
0
 public IAsyncResult BeginBind(SocketEx socket, AsyncCallback callback, object state)
 {
     return((IAsyncResult)this.BeginTimeoutOp(this._connectTimeout, new Bind_Op(this._baseSocket, socket), callback, state));
 }
예제 #10
0
 internal Bind_Op(SocketBase baseSocket, SocketEx primConnSock)
 {
     this._baseSocket   = baseSocket;
     this._primConnSock = primConnSock;
 }
예제 #11
0
 internal Bind_Op(SocketBase baseSocket)
 {
     this._baseSocket   = baseSocket;
     this._primConnSock = null;
 }
예제 #12
0
 public void Bind(SocketEx socket)
 {
     this.DoTimeoutOp(this._connectTimeout, new Bind_Op(this._baseSocket, socket));
 }
예제 #13
0
 /// <summary>
 /// Begins an asynchronous binding.
 /// </summary>
 /// <param name="socket">
 /// An instance of the <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// class which already connected to the remote host through the proxy
 /// server. See remarks for more details.
 /// </param>
 /// <param name="callback">
 /// The <see cref="System.AsyncCallback">AsyncCallback</see> delegate.
 /// </param>
 /// <param name="state">
 /// An object containing state information for this request.
 /// </param>
 /// <returns>
 /// An <see cref="System.IAsyncResult">IAsyncResult</see>
 /// that references the asynchronous bind.
 /// </returns>
 /// 
 /// <remarks>
 /// The <b>BeginBind</b> method starts an asynchronous
 /// binding request.
 /// It returns immediately and does not wait for 
 /// the asynchronous call to complete.
 /// <para>
 /// The 
 /// <see cref="BytesRoad.Net.Sockets.SocketEx.EndBind"/>
 /// method is used to retrieve the results of 
 /// the asynchronous call. It can be called 
 /// any time after <b>BeginBind</b>; if the asynchronous 
 /// call has not completed,
 /// <b>EndBind</b>
 /// will block until it completes.
 /// </para>
 /// 
 /// The behavior of the <b>BeginBind</b> method depends on the proxy type specified
 /// while instance of the <b>SocketEx</b> class constructed. Table below 
 /// represents the behavior of the method for different types of proxy server. 
 /// 
 /// <list type="table">
 /// <listheader>
 /// <term>Type of proxy server</term>
 /// <description>Behavior of the <b>BeginBind</b> method</description>
 /// </listheader>
 /// 
 /// <item>
 /// <term>
 /// <see cref="BytesRoad.Net.Sockets.ProxyType.None"/>
 /// </term>
 /// <description>
 /// The socket will be bound locally to the same IP address 
 /// as the instance of the <b>SocketEx</b> class specified by 
 /// <i>socket</i> parameter.
 /// </description>
 /// </item>
 /// 
 /// <item>
 /// <term>
 /// <see cref="BytesRoad.Net.Sockets.ProxyType.HttpConnect"/>
 /// </term>
 /// <description>
 /// Web proxy not support binding command. The 
 /// <see cref="System.InvalidOperationException"/> would be thrown.
 /// </description>
 /// </item>
 /// 
 /// <item>
 /// <term>
 /// <see cref="BytesRoad.Net.Sockets.ProxyType.Socks4"/>
 /// <para>-or-</para>
 /// <see cref="BytesRoad.Net.Sockets.ProxyType.Socks4a"/>
 /// <para>-or-</para>
 /// <see cref="BytesRoad.Net.Sockets.ProxyType.Socks5"/>
 /// </term>
 /// <description>
 /// The socket will be bound at the proxy server.
 /// Port and IP address may be retrieved via 
 /// <see cref="BytesRoad.Net.Sockets.SocketEx.LocalEndPoint"/> property.
 /// An instance specified by <i>socket</i> parameter must be 
 /// connected with the remote host through physically the same proxy server 
 /// as the instance of the <b>SocketEx</b> class on which <b>BeginBind</b>
 /// method are called.
 /// </description>
 /// </item>
 /// 
 /// </list>
 /// 
 /// </remarks>
 /// 
 /// <exception cref="System.ObjectDisposedException">
 /// The <see cref="BytesRoad.Net.Sockets.SocketEx"/> object was disposed.
 /// </exception>
 /// 
 /// <exception cref="System.InvalidOperationException">
 /// The operation is unsupported.
 /// </exception>
 public IAsyncResult BeginBind(
     SocketEx socket, 
                                 AsyncCallback callback, 
                                 object state)
 {
     return (IAsyncResult)BeginTimeoutOp(
         _connectTimeout,
         new Bind_Op(_baseSocket, socket),
         callback,
         state);
 }
예제 #14
0
 /// <summary>
 /// Associates a <see cref="BytesRoad.Net.Sockets.SocketEx"/> with
 /// local end point at the proxy server.
 /// </summary>
 /// <param name="socket">
 /// An instance of the <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// class which already connected to the remote host through the proxy
 /// server. See remarks for more details.
 /// </param>
 /// <remarks>
 /// The behavior of the <b>Bind</b> method depends on the proxy type specified
 /// while instance of the <b>SocketEx</b> class constructed. Table below 
 /// represents the behavior of the method for different types of proxy server. 
 /// 
 /// <list type="table">
 /// <listheader>
 /// <term>Type of proxy server</term>
 /// <description>Behavior of the <b>Bind</b> method</description>
 /// </listheader>
 /// 
 /// <item>
 /// <term>
 /// <see cref="BytesRoad.Net.Sockets.ProxyType.None"/>
 /// </term>
 /// <description>
 /// The socket will be bound locally to the same IP address 
 /// as the instance of the <b>SocketEx</b> class specified by 
 /// <i>socket</i> parameter.
 /// </description>
 /// </item>
 /// 
 /// <item>
 /// <term>
 /// <see cref="BytesRoad.Net.Sockets.ProxyType.HttpConnect"/>
 /// </term>
 /// <description>
 /// Web proxy not support binding command. The 
 /// <see cref="System.InvalidOperationException"/> would be thrown.
 /// </description>
 /// </item>
 /// 
 /// <item>
 /// <term>
 /// <see cref="BytesRoad.Net.Sockets.ProxyType.Socks4"/>
 /// <para>-or-</para>
 /// <see cref="BytesRoad.Net.Sockets.ProxyType.Socks4a"/>
 /// <para>-or-</para>
 /// <see cref="BytesRoad.Net.Sockets.ProxyType.Socks5"/>
 /// </term>
 /// <description>
 /// The socket will be bound at the proxy server.
 /// Port and IP address may be retrieved via 
 /// <see cref="BytesRoad.Net.Sockets.SocketEx.LocalEndPoint"/> property.
 /// An instance specified by <i>socket</i> parameter must be connected 
 /// with the remote host through physically the same proxy server as 
 /// the instance of the <b>SocketEx</b> class on which 
 /// <b>Bind</b> method are called.
 /// </description>
 /// </item>
 /// 
 /// </list>
 /// 
 /// </remarks>
 /// 
 /// <exception cref="System.ObjectDisposedException">
 /// The <see cref="BytesRoad.Net.Sockets.SocketEx"/> object was disposed.
 /// </exception>
 /// 
 /// <exception cref="System.InvalidOperationException">
 /// The operation is unsupported.
 /// </exception>
 /// 
 /// <exception cref="System.Net.Sockets.SocketException">
 /// An error occurred when attempting to access
 /// the socket which is used to complete the requested operation.
 /// </exception>
 public void Bind(SocketEx socket)
 {
     DoTimeoutOp(_connectTimeout, new Bind_Op(_baseSocket, socket));
 }
예제 #15
0
 /// <summary>
 /// Creates the network stream for the <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// with the specified access rights.
 /// </summary>
 /// <param name="socket">
 /// The
 /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// that the
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// will use to send and receive data over network.
 /// </param>
 /// <param name="access">
 /// A bitwise combination of the
 /// <see cref="System.IO.FileAccess"/>
 /// values, specifying the type of access given to the
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// over the provided <see cref="BytesRoad.Net.Sockets.SocketEx"/>.
 /// </param>
 /// <remarks>
 /// When <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/> created with this constructor,
 /// it does not own the underlying <see cref="BytesRoad.Net.Sockets.SocketEx"/>,
 /// so calling the NetworkStreamEx's
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.Close"/>
 /// method will not close the underlying <b>SocketEx</b>.
 /// <para>
 /// The <i>access</i> parameter sets the
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.CanRead"/> and
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.CanWrite"/>
 /// properties of the <b>NetworkStreamEx</b>.
 /// If you specify <see cref="System.IO.FileAccess.Write"/>, then the <b>NetworkStreamEx</b> will
 /// allow writing operations only. If you specify
 /// <see cref="System.IO.FileAccess.Read"/>, then the <b>NetworkStreamEx</b> will allow read operations only.
 /// If you specify <see cref="System.IO.FileAccess.ReadWrite"/>, both types of operations will be allowed.
 /// </para>
 /// </remarks>
 /// <exception cref="System.ArgumentNullException">
 /// <i>socket</i> is null reference (<b>Nothing</b> in Visual Basic).
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// specified <i>socket</i> is not connected.
 /// </exception>
 public NetworkStreamEx(SocketEx socket, FileAccess access)
 {
     _socket = socket;
     _access = access;
 }
예제 #16
0
 /// <summary>
 /// Creates the network stream for the <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// with the specified access rights and ownership.
 /// </summary>
 /// <param name="socket">
 /// The
 /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// that the
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// will use to send and receive data over network.
 /// </param>
 /// <param name="access">
 /// A bitwise combination of the
 /// <see cref="System.IO.FileAccess"/>
 /// values, specifying the type of access given to the
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// over the provided <see cref="BytesRoad.Net.Sockets.SocketEx"/>.
 /// </param>
 /// <param name="ownsSocket">
 /// <b>true</b> to indicate that the
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// will take ownership of the <see cref="BytesRoad.Net.Sockets.SocketEx"/>; otherwise, <b>false</b>.
 /// </param>
 /// <remarks>
 ///  If <i>ownsSocket</i> is <b>true</b>, the <b>NetworkStreamEx</b> takes ownership of the
 /// underlying <see cref="BytesRoad.Net.Sockets.SocketEx"/>, and calling the NetworkStreamEx's
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.Close"/>
 /// method will also close the underlying <b>SocketEx</b>.
 /// <para>
 /// The <i>access</i> parameter sets the
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.CanRead"/> and
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.CanWrite"/>
 /// properties of the <b>NetworkStreamEx</b>.
 /// If you specify <see cref="System.IO.FileAccess.Write"/>, then the <b>NetworkStreamEx</b> will
 /// allow writing operations only. If you specify
 /// <see cref="System.IO.FileAccess.Read"/>, then the <b>NetworkStreamEx</b> will allow read operations only.
 /// If you specify <see cref="System.IO.FileAccess.ReadWrite"/>, both types of operations will be allowed.
 /// </para>
 ///
 /// </remarks>
 /// <exception cref="System.ArgumentNullException">
 /// <i>socket</i> is null reference (<b>Nothing</b> in Visual Basic).
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// specified <i>socket</i> is not connected.
 /// </exception>
 public NetworkStreamEx(SocketEx socket, FileAccess access, bool ownsSocket)
 {
     _socket     = socket;
     _ownsSocket = ownsSocket;
     _access     = access;
 }
예제 #17
0
 /// <overloads>
 /// Create an instance of the <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/> class.
 /// </overloads>
 /// <summary>
 /// Creates the network stream for the specified <see cref="BytesRoad.Net.Sockets.SocketEx"/>.
 /// </summary>
 /// <param name="socket">
 /// The 
 /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// that the 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/> 
 /// will use to send and receive data over network.
 /// </param>
 /// <remarks>
 /// The 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/> 
 /// is created with read/write access to the specified
 /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>. 
 /// The <b>NetworkStreamEx</b> does not own the underlying <b>SocketEx</b>, so calling the
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.Close"/> method will not 
 /// close the <b>SocketEx</b>.
 /// </remarks>
 /// <exception cref="System.ArgumentNullException">
 /// <i>socket</i> is null reference (<b>Nothing</b> in Visual Basic).
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// specified <i>socket</i> is not connected.
 /// </exception>
 public NetworkStreamEx(SocketEx socket)
 {
     _socket = socket;
 }
예제 #18
0
 /// <summary>
 /// Creates the network stream for the <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// with the specified ownership.
 /// </summary>
 /// <param name="socket">
 /// The 
 /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>
 /// that the 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/> 
 /// will use to send and receive data over network.
 /// </param>
 /// <param name="ownsSocket">
 /// <b>true</b> to indicate that the 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/>
 /// will take ownership of the <see cref="BytesRoad.Net.Sockets.SocketEx"/>; otherwise, <b>false</b>. 
 /// </param>
 /// <remarks>
 /// The 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx"/> 
 /// is created with read/write access to the specified
 /// <see cref="BytesRoad.Net.Sockets.SocketEx"/>. 
 /// If <i>ownsSocket</i> is <b>true</b>, the <b>NetworkStreamEx</b> takes ownership of the 
 /// underlying <see cref="BytesRoad.Net.Sockets.SocketEx"/>, 
 /// and calling the NetworkStreamEx's 
 /// <see cref="BytesRoad.Net.Sockets.NetworkStreamEx.Close"/>
 /// method will also close the underlying <b>SocketEx</b>.
 /// </remarks>
 /// <exception cref="System.ArgumentNullException">
 /// <i>socket</i> is null reference (<b>Nothing</b> in Visual Basic).
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// specified <i>socket</i> is not connected.
 /// </exception>
 public NetworkStreamEx(SocketEx socket, bool ownsSocket)
 {
     _socket = socket;
     _ownsSocket = ownsSocket;
 }
예제 #19
0
            SocketEx   _primConnSock; // primary connection (used for socks proxy)

            // constructor used for async end
            internal Bind_Op(SocketBase baseSocket)
            {
                _baseSocket = baseSocket;
                _primConnSock = null;
            }