Class Client
Class TM.Client.
Implements the System.IDisposable
Implements the System.IDisposable
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: TM
Assembly: TM.dll
Syntax
public class Client : IDisposable
Fields
| Improve this Doc View SourceConnectionTryCount
The default value of connection try out count
Declaration
public static int ConnectionTryCount
Field Value
Type | Description |
---|---|
System.Int32 |
ReadData
The read data
Declaration
public BufferChunk ReadData
Field Value
Type | Description |
---|---|
BufferChunk |
Sender
The TCP sender
Declaration
public TcpClient Sender
Field Value
Type | Description |
---|---|
System.Net.Sockets.TcpClient |
Properties
| Improve this Doc View SourceHeader
Gets the packet header.
Declaration
public PacketHeader Header { get; protected set; }
Property Value
Type | Description |
---|---|
PacketHeader | The header. |
IP
Declaration
public string IP { get; set; }
Property Value
Type | Description |
---|---|
System.String |
IpAddress
Gets the server IP address.
Declaration
public string IpAddress { get; set; }
Property Value
Type | Description |
---|---|
System.String | The IP address. |
IsConnected
Gets a value indicating whether this Client is connected.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if connected; otherwise, false . |
LocalEndPoint
Gets the local end point.
Declaration
public IPEndPoint LocalEndPoint { get; }
Property Value
Type | Description |
---|---|
System.Net.IPEndPoint | The local end point. |
LocalIpAddress
Gets the local IP address.
Declaration
public string LocalIpAddress { get; }
Property Value
Type | Description |
---|---|
System.String | The local IP address. |
LocalPort
Gets the local port.
Declaration
public int LocalPort { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The local port. |
Port
Gets the remote server port.
Declaration
public int Port { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The remote port. |
RemoteEndPoint
Gets the remote end point.
Declaration
public IPEndPoint RemoteEndPoint { get; }
Property Value
Type | Description |
---|---|
System.Net.IPEndPoint | The remote end point. |
StateData
Gets the StateData structure.
Declaration
public StateData StateData { get; protected set; }
Property Value
Type | Description |
---|---|
StateData | The server. |
Methods
| Improve this Doc View SourceConnect(String, Int32)
Connects the specified ip.
Declaration
public virtual bool Connect(string ip = null, int port = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | ip | The ip. |
System.Int32 | port | The port. |
Returns
Type | Description |
---|---|
System.Boolean | true if XXXX, false otherwise. |
Disconnect()
Disconnects from server
Declaration
public virtual bool Disconnect()
Returns
Type | Description |
---|---|
System.Boolean | true if disconnect is OK, false otherwise. |
Dispose()
Performs application-defined tasks associated with freeing,
releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
ProcessData(BufferChunk, Int32)
Process received data from server
Declaration
public virtual void ProcessData(BufferChunk readData, int numberOfBytesRead)
Parameters
Type | Name | Description |
---|---|---|
BufferChunk | readData | |
System.Int32 | numberOfBytesRead |
ProcessState(StateData)
Process received state data from server
Declaration
public virtual void ProcessState(StateData stateData)
Parameters
Type | Name | Description |
---|---|---|
StateData | stateData |
Reset()
Resets this instance.
Declaration
public virtual void Reset()
Send(Byte[], EServerType)
Sends the plan as byte array to server.
Declaration
public virtual bool Send(byte[] data, EServerType server_type = EServerType.MCS)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data. |
EServerType | server_type | Type of the server. |
Returns
Type | Description |
---|---|
System.Boolean | true on success, false otherwise. |
Exceptions
Type | Condition |
---|---|
SendDataException |
Send(UInt32, Byte[], EServerType)
Sends the byte array of data to server.
Declaration
public virtual bool Send(uint len, byte[] data, EServerType server_type = EServerType.MCS)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | len | The length. |
System.Byte[] | data | The data. |
EServerType | server_type | Type of the server. |
Returns
Type | Description |
---|---|
System.Boolean | true if OK, false otherwise. |
Exceptions
Type | Condition |
---|---|
SendDataException |
Send(BufferChunk, EServerType)
Sends the plan data as BufferChunk to server.
Declaration
public virtual bool Send(BufferChunk data, EServerType server_type = EServerType.MCS)
Parameters
Type | Name | Description |
---|---|---|
BufferChunk | data | The data. |
EServerType | server_type | Type of the server. |
Returns
Type | Description |
---|---|
System.Boolean | true if OK, false otherwise. |
Send(Packet)
Sends the Packet to server.
Declaration
public virtual bool Send(Packet p)
Parameters
Type | Name | Description |
---|---|---|
Packet | p | The Packet. |
Returns
Type | Description |
---|---|
System.Boolean | true on success, false otherwise. |
SendInfo(String, EServerType)
Sends the information to server.
Declaration
public virtual bool SendInfo(string info, EServerType server_type = EServerType.MCS)
Parameters
Type | Name | Description |
---|---|---|
System.String | info | The information. |
EServerType | server_type | Type of the server. |
Returns
Type | Description |
---|---|
System.Boolean | true on success, false otherwise. |
Exceptions
Type | Condition |
---|---|
SendInfoException |
Events
| Improve this Doc View SourceDataBlockReceived
Occurs when [data block received].
Declaration
public event DataHandler DataBlockReceived
Event Type
Type | Description |
---|---|
DataHandler |
ErrorReceived
Occurs when [on error received].
Declaration
public event ClientHandler ErrorReceived
Event Type
Type | Description |
---|---|
ClientHandler |
InfoReceived
Occurs when [on info received].
Declaration
public event ClientHandler InfoReceived
Event Type
Type | Description |
---|---|
ClientHandler |
ServerConnected
Occurs when [server connected].
Declaration
public event ClientHandler ServerConnected
Event Type
Type | Description |
---|---|
ClientHandler |
ServerDisconnected
Occurs when [server disconnected].
Declaration
public event ClientHandler ServerDisconnected
Event Type
Type | Description |
---|---|
ClientHandler |
ServerStateChanged
Occurs when [server state changed].
Declaration
public event StateHandler ServerStateChanged
Event Type
Type | Description |
---|---|
StateHandler |
Implements
System.IDisposable
See Also
System.IDisposable