C# Class SipSharp.Transports.TcpTransport

Transports messages over TCP.
This transport takes care of ALL sockets for TCP.
Inheritance: ITransport
Datei anzeigen Open project: jgauffin/SipSharp Class Usage Examples

Public Methods

Method Description
Send ( EndPoint endPoint, byte buffer, int offset, int count ) : void

Send a buffer to a certain end point.

Start ( ) : void

Starts the specified end point.

TcpTransport ( IPEndPoint endPoint, MessageFactory factory ) : System

Initializes a new instance of the TcpTransport class.

Protected Methods

Method Description
CreateAndConnect ( IPEndPoint endPoint ) : ClientContext

Create a new socket and try to connect to a remote client/server.

SetupNewContext ( Socket socket ) : void

Create a new context and allocate it's buffer.

Private Methods

Method Description
HandleDisconnect ( ClientContext context ) : void
OnAccept ( IAsyncResult ar ) : void
OnReceive ( IAsyncResult ar ) : void
OnSend ( IAsyncResult ar ) : void

Method Details

CreateAndConnect() protected method

Create a new socket and try to connect to a remote client/server.
If connection fails.
protected CreateAndConnect ( IPEndPoint endPoint ) : ClientContext
endPoint System.Net.IPEndPoint Endpoint that should get connected.
return ClientContext

Send() public method

Send a buffer to a certain end point.
is not of the type expected by the transport implementation endPoint is null. offset+count is out of range.
public Send ( EndPoint endPoint, byte buffer, int offset, int count ) : void
endPoint System.Net.EndPoint End point that the buffer should be sent to.
buffer byte buffer to send.
offset int Position of first byte to send.
count int Number of bytes, from offset, to send.
return void

SetupNewContext() protected method

Create a new context and allocate it's buffer.
Could not allocate new buffer. Could not read from socket. Socket have been disposed.
protected SetupNewContext ( Socket socket ) : void
socket Socket The socket.
return void

Start() public method

Starts the specified end point.
is not of the type expected by the transport implementation endPoint is null. If listener cannot be started.
public Start ( ) : void
return void

TcpTransport() public method

Initializes a new instance of the TcpTransport class.
public TcpTransport ( IPEndPoint endPoint, MessageFactory factory ) : System
endPoint System.Net.IPEndPoint End point to accept new connections on.
factory SipSharp.Messages.MessageFactory Message factory.
return System