C# 클래스 P2PStateServer.ServiceSocket

Represents an exception-safe wrapper of the .NET socket class. It exposes asynchronous methods and properties useful for state server soket operations.
The .NET Socket class is thread-safe but you can never be too careful. This class introduces an extra synchronization layer.
파일 보기 프로젝트 열기: tenor/p2pStateServer 1 사용 예제들

공개 메소드들

메소드 설명
Abort ( ) : void

Terminates a connection

BeginConnect ( string Host, int Port, AsyncCallback ConnectCallBack, object StateObject ) : IAsyncResult

Begins an asynchronous Connect

BeginReceive ( int BufferLength, AsyncCallback ReadCallBack, object StateObject ) : IAsyncResult

Begins an asynchronous receive

CheckConnection ( ) : bool

Returns a value which indicates whether the socket is still connected.

This method actively checks the connection status by sending a zero-sized payload packet to inbound sockets or calling Socket.Poll for outbound sockets.

Close ( ) : void

Closes the socket gracefully

EndConnect ( IAsyncResult ar ) : void

Ends an asynchronous Connect

EndReceive ( IAsyncResult ar, bool &Error ) : byte[]

Ends an asynchronous Receive

Equals ( object obj ) : bool
GetHashCode ( ) : int
Listen ( int Port, AsyncCallback AcceptCallback ) : Socket

Listens on a specified port on the machine

Send ( ResponseData Message ) : void

Sends data via the socket asynchronously

ServiceSocket ( Socket socket, bool IsPeerSocket, IBufferPool Buffers ) : System

Initializes a new instance of the ServiceSocket class.

ServiceSocket ( bool IsPeerSocket, IBufferPool Buffers ) : System

Initializes a new instance of the ServiceSocket class.

비공개 메소드들

메소드 설명
CompleteSend ( IAsyncResult ar ) : void

Completes an asynchronous send

ServiceSocket ( ) : System

메소드 상세

Abort() 공개 메소드

Terminates a connection
public Abort ( ) : void
리턴 void

BeginConnect() 공개 메소드

Begins an asynchronous Connect
public BeginConnect ( string Host, int Port, AsyncCallback ConnectCallBack, object StateObject ) : IAsyncResult
Host string Host to connect to
Port int Port number to connect to
ConnectCallBack AsyncCallback Callback to call on connecting
StateObject object State object to pass to ConnectCallback
리턴 IAsyncResult

BeginReceive() 공개 메소드

Begins an asynchronous receive
public BeginReceive ( int BufferLength, AsyncCallback ReadCallBack, object StateObject ) : IAsyncResult
BufferLength int
ReadCallBack AsyncCallback Method to call on receiving data
StateObject object State object to be passed to ReadCallBack
리턴 IAsyncResult

CheckConnection() 공개 메소드

Returns a value which indicates whether the socket is still connected.
This method actively checks the connection status by sending a zero-sized payload packet to inbound sockets or calling Socket.Poll for outbound sockets.
public CheckConnection ( ) : bool
리턴 bool

Close() 공개 메소드

Closes the socket gracefully
public Close ( ) : void
리턴 void

EndConnect() 공개 메소드

Ends an asynchronous Connect
public EndConnect ( IAsyncResult ar ) : void
ar IAsyncResult AsyncResult obtained from BeginConnect
리턴 void

EndReceive() 공개 메소드

Ends an asynchronous Receive
public EndReceive ( IAsyncResult ar, bool &Error ) : byte[]
ar IAsyncResult AsyncResult obtained from BeginReive
Error bool Indicates an error occured while receiving data
리턴 byte[]

Equals() 공개 메소드

public Equals ( object obj ) : bool
obj object
리턴 bool

GetHashCode() 공개 메소드

public GetHashCode ( ) : int
리턴 int

Listen() 공개 정적인 메소드

Listens on a specified port on the machine
public static Listen ( int Port, AsyncCallback AcceptCallback ) : Socket
Port int Port number
AcceptCallback AsyncCallback Callback for accepting new connections
리턴 Socket

Send() 공개 메소드

Sends data via the socket asynchronously
public Send ( ResponseData Message ) : void
Message ResponseData Data to transmit
리턴 void

ServiceSocket() 공개 메소드

Initializes a new instance of the ServiceSocket class.
public ServiceSocket ( Socket socket, bool IsPeerSocket, IBufferPool Buffers ) : System
socket Socket The .NET Socket object to encapsulate
IsPeerSocket bool Indicates if this socket was spawned from the state server peer port
Buffers IBufferPool
리턴 System

ServiceSocket() 공개 메소드

Initializes a new instance of the ServiceSocket class.
public ServiceSocket ( bool IsPeerSocket, IBufferPool Buffers ) : System
IsPeerSocket bool Indicates if this socket was spawned from the state server peer port
Buffers IBufferPool
리턴 System