NetSamples.Common.Net
Class TcpConnection

Represents a TCP connection

Field Summary
System.Net.Sockets.Socket socket
System.Net.Sockets.NetworkStream stream

Constructor Summary
TcpConnection()
         Constructor
TcpConnection(System.Net.Sockets.Socket clientsocket)
         Constructor

Property Summary
bool Connected
         Has a connection been established ?
System.Net.IPEndPoint LocalEndPoint
         The local endpoint
System.Net.IPEndPoint RemoteEndPoint
         Get the remote endpoint

Method Summary
void Close()
         Close the connection
void Connect(System.Net.IPEndPoint endpoint)
         Connect to a remote endpoint
System.Net.Sockets.NetworkStream GetStream()
         Get the network stream for the connection
void Receive(byte[] data)
         Receive data
void Send(byte[] data)
         Send data

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Field Detail

socket

protected System.Net.Sockets.Socket socket


stream

protected System.Net.Sockets.NetworkStream stream

Constructor Detail

TcpConnection

public TcpConnection()

Constructor


TcpConnection

public TcpConnection(System.Net.Sockets.Socket clientsocket)

Constructor

Property Detail

Connected

public bool Connected

Has a connection been established ?


LocalEndPoint

public System.Net.IPEndPoint LocalEndPoint

The local endpoint


RemoteEndPoint

public System.Net.IPEndPoint RemoteEndPoint

Get the remote endpoint

Method Detail

Close

public void Close()

Close the connection


Connect

public void Connect(System.Net.IPEndPoint endpoint)

Connect to a remote endpoint


GetStream

public System.Net.Sockets.NetworkStream GetStream()

Get the network stream for the connection


Receive

public void Receive(byte[] data)

Receive data


Send

public void Send(byte[] data)

Send data