March 2002
Intermediate to advanced
864 pages
31h 8m
English
TcpClient
This class provides a client-side abstraction of the sockets API. The
zero-argument form of the constructor creates the client. Connect to a
remote server with the Connect() method
(you must specify an existing System.Net.IPEndPoint
or a remote IP address and port number). Alternatively, use an overloaded
form of the constructor to simultaneously create the client and make the
connection.
This class completely obscures the underlying socket. However, the GetStream() method returns
a NetworkStream that you can use to
send and receive data across the network.
public class TcpClient : IDisposable { // Public Constructors public method TcpClient(); public method TcpClient(System.Net.IPEndPoint localEP); public method TcpClient(string hostname, int port); // Public Instance Properties public field LingerOption LingerState{set; get; } public field bool NoDelay{set; get; } public field int ReceiveBufferSize{set; get; } public field int ReceiveTimeout{set; get; } public field int SendBufferSize{set; get; } public field int SendTimeout{set; get; } // Protected Instance Properties protected field bool Active{set; get; } protected field Socket Client{set; get; } // Public Instance Methods public method void Close(); public method void Connect(System.Net.IPAddress address, int port); public method void Connect( System.Net.IPEndPoint remoteEP); public method void Connect(string hostname, int port); public method NetworkStream GetStream(); // Protected Instance Methods ...