//------------------------------------------------------------------------------
// <copyright file="TCPClient.cs" company="Microsoft">
//
// Copyright (c) 2002 Microsoft Corporation. All rights reserved.
//
// The use and distribution terms for this software are contained in the file
// named license.txt, which can be found in the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by the
// terms of this license.
//
// You must not remove this notice, or any other, from this software.
//
// </copyright>
//------------------------------------------------------------------------------
namespace System.Net.Sockets {
/// <include file='doc/TCPClient.uex' path='docs/doc[@for="TcpClient"]/*' />
/// <devdoc>
/// <para>The <see cref='System.Net.Sockets.TcpClient'/> class provide TCP services at a higher level
/// of abstraction than the <see cref='System.Net.Sockets.Socket'/> class. <see cref='System.Net.Sockets.TcpClient'/>
/// is used to create a Client connection to a remote host.</para>
/// </devdoc>
public class TcpClient : IDisposable {
Socket m_ClientSocket;
bool m_Active;
NetworkStream m_DataStream;
bool m_DataStreamCreated;
// specify local IP and port
/// <include file='doc/TCPClient.uex' path='docs/doc[@for="TcpClient.TcpClient"]/*' />
/// <devdoc>
/// <para>
/// Initializes a new instance of the <see cref='System.Net.Sockets.TcpClient'/>
/// class with the specified end point.
/// </para>
/// </devdoc>
public TcpClient(IPEndPoint localEP) {
if (localEP==null) {
throw new ArgumentNullException("localEP");
}
initialize();
Client.Bind(localEP);
}
// TcpClient(IPaddress localaddr); // port is arbitrary
// TcpClient(int outgoingPort); // local IP is arbitrary
// address+port is arbitrary
/// <include file='doc/TCPClient.uex' path='docs/doc[@for="TcpClient.TcpClient1"]/*' />
/// <devdoc>
/// <para>
/// Initializes a new instance of the <see cref='System.Net.Sockets.TcpClient'/> class.
/// </para>
/// </devdoc>
public TcpClient() {
initialize();
}
// bind and connect
/// <include file='doc/TCPClient.uex' path='docs/doc[@for="TcpClient.TcpClient2"]/*' />
/// <devdoc>
/// <para>Initializes a new instance of the <see cref='System.Net.Sockets.TcpClient'/> class and connects to the
/// specified port on the