Click or drag to resize
TcpNetworkClient Class
TCP client implementation.
Inheritance Hierarchy
SystemObject
  StreamCoders.NetworkTcpNetworkClient

Namespace: StreamCoders.Network
Assembly: MediaBase (in MediaBase.dll) Version: 2.0.5.0 (2.0.5.0)
Syntax
public class TcpNetworkClient

The TcpNetworkClient type exposes the following members.

Constructors
  NameDescription
Public methodTcpNetworkClient
Default constructor.
Public methodTcpNetworkClient(AddressFamily)
Constructor.
Public methodTcpNetworkClient(Socket, State)
Instantiates TCPClient with a socket directly.

Instantiating TCPClient with an already created socket. Calling Init is not required and will result in an exception being thrown.

Public methodTcpNetworkClient(AddressFamily, Boolean, Int16, Int32)
Constructor.
Top
Properties
  NameDescription
Public propertyIsConnected
Returns true if socket is connected to endpoint, otherwise false.
Public propertyRemoteEndpoint
Gets the underlying remote endpoint. The value is only valid when the underlying socket is connected.
Top
Methods
  NameDescription
Public methodClose
Closes the established connection.
Public methodConnect(EndPoint, Boolean)
Initiates TCP connect to remote endpoint.
Public methodConnect(String, Int32, Boolean)
Initiates TCP connect to remote endpoint.
Public methodEquals
Tests if this TcpNetworkClient is considered equal to another.
Public methodSend(Byte)
Sends a buffer to the remote end of the connection.
Public methodSend(String)
Send this message.
Public methodSend(OffsetBufferByte)
Sends a buffer to the remote end of the connection.
Public methodShutdown
Call Shutdown before Close() to ensure that data is sent/received before the socket is closed.
Public methodStartReceiveChain
When packet reception is needed, this method starts the initial receive chain.
Top
Events
  NameDescription
Public eventOnConnected
Optional. Is called when a connection is initially established.
Public eventOnDisconnect
Will be called once on transition from Connected to Disconnected.
Public eventOnError
Is called when the underlying socket has transitioned to an error state.
Public eventOnReceive
Is called when a packet has been received.
Public eventOnSend
Is called after an asynchronous send operation has completed.
Top
Fields
  NameDescription
Public fieldConnectTimeout
Timespan to wait for connection to be established when synchronous parameter is true.
Public fieldKeepAliveInterval
Interval in which keep-alive messages are sent.
Public fieldKeepAliveTimeout
Time until a half-closed / half-open connection is terminated. This can be the case when a router or cable was disconnected.

To turn off keep-alive checking set KeepAliveTimeout to Timespan.Zero

Public fieldSendTimeout
TimeSpan specifying how long to wait for Send operation to finish before socket is closed and OnError is invoked. Set this property to TimeSpan.Zero to disable send timeout. When a socket send operation times out an OnError event will be generated where Error == SocketError.TimedOut, after which appropriate action must be taken by the application.
Top
Extension Methods
  NameDescription
Public Extension MethodCopyOverloaded.
Creates a copy of the object.
(Defined by ObjectExtensions.)
Public Extension MethodCopy(Object)Overloaded.
Creates a deep copy of the object using the supplied object as a target for the copy operation.
(Defined by ObjectExtensions.)
Top
See Also