C# 클래스 GamingInterface.PlayerInputServer

Implements the connection logic for the socket server. After accepting a connection, all data read from the client is sent back to the client. The read and echo back to the client pattern is continued until the client disconnects.
파일 보기 프로젝트 열기: RocHCI/legion-gaming 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
analogLoc int[][]
leader int
mode int
myport int
numSelects int
playerID Byte
pressed bool[]
wasPressedCM bool
wasPressedCMDOWN bool
wasPressedCMHOLE bool
wasPressedCMLEFT bool
wasPressedCMRIGHT bool
wasPressedCMUP bool
wasPressedPM bool

공개 메소드들

메소드 설명
AcceptEventArg_Completed ( object sender, SocketAsyncEventArgs e ) : void

This method is the callback method associated with Socket.AcceptAsync operations and is invoked when an accept operation is complete

IO_Completed ( object sender, SocketAsyncEventArgs e ) : void

This method is called whenever a receive or send opreation is completed on a socket

Init ( ) : void

Initializes the server by preallocating reusable buffers and context objects. These objects do not need to be preallocated or reused, by is done this way to illustrate how the API can easily be used to create reusable objects to increase server performance.

PlayerInputServer ( int numConnections, int receiveBufferSize, MainInterface myParent, int myPlayerID ) : System

Create an uninitialized server instance. To start the server listening for connection requests call the Init method followed by Start method

Start ( IPEndPoint localEndPoint ) : void

Starts the server such that it is listening for incoming connection requests.

StartAccept ( SocketAsyncEventArgs acceptEventArg ) : void

Begins an operation to accept a connection request from the client

비공개 메소드들

메소드 설명
CloseClientSocket ( SocketAsyncEventArgs e ) : void
GetBits ( byte b ) : IEnumerable
ProcessAccept ( SocketAsyncEventArgs e ) : void
ProcessReceive ( SocketAsyncEventArgs e ) : void

This method is invoked when an asycnhronous receive operation completes. If the remote host closed the connection, then the socket is closed. If data was received then the data is echoed back to the client.

ProcessSend ( SocketAsyncEventArgs e ) : void

This method is invoked when an asynchronous send operation completes. The method issues another receive on the socket to read any additional data sent from the client

메소드 상세

AcceptEventArg_Completed() 공개 메소드

This method is the callback method associated with Socket.AcceptAsync operations and is invoked when an accept operation is complete
public AcceptEventArg_Completed ( object sender, SocketAsyncEventArgs e ) : void
sender object
e System.Net.Sockets.SocketAsyncEventArgs
리턴 void

IO_Completed() 공개 메소드

This method is called whenever a receive or send opreation is completed on a socket
public IO_Completed ( object sender, SocketAsyncEventArgs e ) : void
sender object
e System.Net.Sockets.SocketAsyncEventArgs SocketAsyncEventArg associated with the completed receive operation
리턴 void

Init() 공개 메소드

Initializes the server by preallocating reusable buffers and context objects. These objects do not need to be preallocated or reused, by is done this way to illustrate how the API can easily be used to create reusable objects to increase server performance.
public Init ( ) : void
리턴 void

PlayerInputServer() 공개 메소드

Create an uninitialized server instance. To start the server listening for connection requests call the Init method followed by Start method
public PlayerInputServer ( int numConnections, int receiveBufferSize, MainInterface myParent, int myPlayerID ) : System
numConnections int the maximum number of connections the sample is designed to handle simultaneously
receiveBufferSize int buffer size to use for each socket I/O operation
myParent MainInterface
myPlayerID int
리턴 System

Start() 공개 메소드

Starts the server such that it is listening for incoming connection requests.
public Start ( IPEndPoint localEndPoint ) : void
localEndPoint System.Net.IPEndPoint The endpoint which the server will listening for conenction requests on
리턴 void

StartAccept() 공개 메소드

Begins an operation to accept a connection request from the client
public StartAccept ( SocketAsyncEventArgs acceptEventArg ) : void
acceptEventArg System.Net.Sockets.SocketAsyncEventArgs The context object to use when issuing the accept operation on the /// server's listening socket
리턴 void

프로퍼티 상세

analogLoc 공개적으로 프로퍼티

public int[][] analogLoc
리턴 int[][]

leader 공개적으로 프로퍼티

public int leader
리턴 int

mode 공개적으로 프로퍼티

public int mode
리턴 int

myport 공개적으로 프로퍼티

public int myport
리턴 int

numSelects 공개적으로 프로퍼티

public int numSelects
리턴 int

playerID 공개적으로 프로퍼티

public Byte playerID
리턴 Byte

pressed 공개적으로 프로퍼티

public bool[] pressed
리턴 bool[]

wasPressedCM 공개적으로 프로퍼티

public bool wasPressedCM
리턴 bool

wasPressedCMDOWN 공개적으로 프로퍼티

public bool wasPressedCMDOWN
리턴 bool

wasPressedCMHOLE 공개적으로 프로퍼티

public bool wasPressedCMHOLE
리턴 bool

wasPressedCMLEFT 공개적으로 프로퍼티

public bool wasPressedCMLEFT
리턴 bool

wasPressedCMRIGHT 공개적으로 프로퍼티

public bool wasPressedCMRIGHT
리턴 bool

wasPressedCMUP 공개적으로 프로퍼티

public bool wasPressedCMUP
리턴 bool

wasPressedPM 공개적으로 프로퍼티

public bool wasPressedPM
리턴 bool