Class SIPStreamConnection
Represents a reliable stream connection (e.g. TCP or TLS) between two end points. Stream connections have a more overhead than UDP. The state of the connection has to be monitored and messages on the stream can be spread across multiple packets.
Inheritance
Inherited Members
Namespace: SIPSorcery.SIP
Assembly: SIPSorcery.dll
Syntax
public class SIPStreamConnection
Constructors
| Improve this Doc View SourceSIPStreamConnection(Socket, SIPEndPoint, SIPProtocolsEnum)
Declaration
public SIPStreamConnection(Socket streamSocket, SIPEndPoint remoteSIPEndPoint, SIPProtocolsEnum connectionProtocol)
Parameters
Type | Name | Description |
---|---|---|
System.Net.Sockets.Socket | streamSocket | |
SIPEndPoint | remoteSIPEndPoint | |
SIPProtocolsEnum | connectionProtocol |
SIPStreamConnection(Socket, Encoding, Encoding, SIPEndPoint, SIPProtocolsEnum)
Records the crucial stream connection properties and initialises the required buffers.
Declaration
public SIPStreamConnection(Socket streamSocket, Encoding sipEncoding, Encoding sipBodyEncoding, SIPEndPoint remoteSIPEndPoint, SIPProtocolsEnum connectionProtocol)
Parameters
Type | Name | Description |
---|---|---|
System.Net.Sockets.Socket | streamSocket | The local socket the stream is using. |
System.Text.Encoding | sipEncoding | |
System.Text.Encoding | sipBodyEncoding | |
SIPEndPoint | remoteSIPEndPoint | The remote network end point of this connection. |
SIPProtocolsEnum | connectionProtocol | Whether the stream is TCP or TLS. |
Fields
| Improve this Doc View SourceCONNECTION_ID_LENGTH
Declaration
public static int CONNECTION_ID_LENGTH
Field Value
Type | Description |
---|---|
System.Int32 |
ConnectionProtocol
The connection protocol in use for this stream (TCP or TLS).
Declaration
public SIPProtocolsEnum ConnectionProtocol
Field Value
Type | Description |
---|---|
SIPProtocolsEnum |
LastTransmission
Records when a transmission was last sent or received on this stream.
Declaration
public DateTime LastTransmission
Field Value
Type | Description |
---|---|
System.DateTime |
MaxSIPTCPMessageSize
Declaration
public static int MaxSIPTCPMessageSize
Field Value
Type | Description |
---|---|
System.Int32 |
RecvSocketArgs
Declaration
public SocketAsyncEventArgs RecvSocketArgs
Field Value
Type | Description |
---|---|
System.Net.Sockets.SocketAsyncEventArgs |
RemoteSIPEndPoint
The remote end point for the stream.
Declaration
public SIPEndPoint RemoteSIPEndPoint
Field Value
Type | Description |
---|---|
SIPEndPoint |
SslStream
For secure streams the TCP connection will be upgraded to an SSL stream and the SslStreamBuffer will be used for receives.
Declaration
public SIPStreamWrapper SslStream
Field Value
Type | Description |
---|---|
SIPStreamWrapper |
SslStreamBuffer
The receive buffer to use for SSL streams.
Declaration
public byte[] SslStreamBuffer
Field Value
Type | Description |
---|---|
System.Byte[] |
StreamSocket
The underlying TCP socket for the stream connection. To take advantage of newer async TCP IO operations the RecvSocketArgs is used for TCP channel receives.
Declaration
public Socket StreamSocket
Field Value
Type | Description |
---|---|
System.Net.Sockets.Socket |
Properties
| Improve this Doc View SourceConnectionID
A unique ID for this connection. It will be recorded on any received messages to allow responses to quickly identify the same connection.
Declaration
public string ConnectionID { get; }
Property Value
Type | Description |
---|---|
System.String |
RecvEndPosn
The current end position of unprocessed data in the receive buffer.
Declaration
public int RecvEndPosn { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
RecvStartPosn
The current start position of unprocessed data in the receive buffer.
Declaration
public int RecvStartPosn { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceExtractSIPMessages(SIPChannel, Byte[], Int32)
Attempts to extract SIP messages from the data that has been received on the SIP stream connection.
Declaration
public void ExtractSIPMessages(SIPChannel recvChannel, byte[] buffer, int bytesRead)
Parameters
Type | Name | Description |
---|---|---|
SIPChannel | recvChannel | The receiving SIP channel. |
System.Byte[] | buffer | The buffer holding the current data from the stream. Note that the buffer can stretch over multiple receives. |
System.Int32 | bytesRead | The bytes that were read by the latest receive operation (the new bytes available). |
Events
| Improve this Doc View SourceSIPMessageReceived
Event for new SIP requests or responses becoming available.
Declaration
public event SIPMessageReceivedAsyncDelegate SIPMessageReceived
Event Type
Type | Description |
---|---|
SIPMessageReceivedAsyncDelegate |