C# 클래스 ServerNetworkConnections.ClientConnection

This class represents a connection to a remote host. It is possible to notify this host with messages that extends upon the "AbstractMessage" class. HOW TO USE: * Initialize the class with needed parameters (see constructor) * Call "Start()" method to start listening for incoming messages and start to write messages * Whenever a message is received from the server, the OnMessageReceived callback is called. * Whenever a message is received but in a corrupted format, the OnMessageFailed is called. * If the connection to the server fails, the OnConnectionFailed is called. The underlying connection will automatically be closed, so you do not need to call the stop method if this delegate is fired. * Writing to the server is non-blocking. All it does is to place the message into a buffer that is then handled by another thread.
파일 보기 프로젝트 열기: bakacaptain/istalkapp 1 사용 예제들

공개 메소드들

메소드 설명
ClientConnection ( TCPConnection connection ) : System

Constructor for ClientConnection

Notify ( AbstractMessage msg ) : void

Method that places a message in a buffer to be sent to the server. This is a non-blocking call.

Start ( ) : void

Method that makes the connection start listening and writing messages to it's attached socket.

Stop ( ) : void

Method that closes the connection.

비공개 메소드들

메소드 설명
InternalTerminationProcedure ( ) : void

Internal methods to terminate the ClientConnection when an unexpected failure happens.

메소드 상세

ClientConnection() 공개 메소드

Constructor for ClientConnection
public ClientConnection ( TCPConnection connection ) : System
connection TCPConnection This is a TCPConnection representing the connection to the client
리턴 System

Notify() 공개 메소드

Method that places a message in a buffer to be sent to the server. This is a non-blocking call.
public Notify ( AbstractMessage msg ) : void
msg AbstractMessage
리턴 void

Start() 공개 메소드

Method that makes the connection start listening and writing messages to it's attached socket.
public Start ( ) : void
리턴 void

Stop() 공개 메소드

Method that closes the connection.
public Stop ( ) : void
리턴 void