TcpConnection ClassBespoke Osc Library
Represents a single TCP/IP connection.
Inheritance Hierarchy

OnlineSystem Object
  Bespoke.Common.Net TcpConnection

Namespace: Bespoke.Common.Net
Assembly: Bespoke.Common (in Bespoke.Common.dll) Version: (

Public Class TcpConnection _
	Implements IDisposable

TcpConnection objects can be used in conjunction with TcpServer or as simple wrappers to a OnlineSocket. Data can be received automatically by the TcpConnection object by invoking the ReceiveDataAsynchronously method. This mechanism transmits the data asynchronously using Socket.BeginReceive/EndReceive. Additionally, messages are framed using a 4-byte integer containing the length of the message. The DataReceived event is raised as complete messages are received. Users can perform their own message handling by not invoking the ReceiveDataAsynchronously method and accessing the TcpConnection.Client/Reader/Writer properties directly. When performing manual data handling, in conjunction with a TcpServer object, set the ReceiveDataInline property to false.
See Also