C# Class TrotiNet.TcpServer

Implementation of a TCP/IP server
Exibir arquivo Open project: Gizeta/Nekoxy-fiddler Class Usage Examples

Protected Properties

Property Type Description
ConnectedSockets HttpSocket>.Dictionary
LocalPort int

Public Methods

Method Description
Start ( OnNewClient onConnection ) : void

Spawn a thread that listens to incoming connections

Stop ( ) : void

Stop the listening threads and close the client sockets

TcpServer ( int localPort, bool bUseIPv6 ) : System

Initialize, but do not start, a multi-threaded TCP server listening for localhost connections only

Protected Methods

Method Description
AcceptCallback ( IAsyncResult ar ) : void

Callback method for accepting new connections

CheckSockets ( object eventState ) : void

Close broken sockets

This function is called regularly to clean up the list of connected sockets.

CloseSocket ( HttpSocket state ) : void

Remove the socket contained in the given state object from the connected array list and hash table, then close the socket

Pause ( ) : void
StartListening ( Socket &ListeningSocket ) : void

Open a listener socket and wait for connections

StartThread ( ) : void

Method Details

AcceptCallback() protected method

Callback method for accepting new connections
protected AcceptCallback ( IAsyncResult ar ) : void
ar IAsyncResult
return void

CheckSockets() protected method

Close broken sockets
This function is called regularly to clean up the list of connected sockets.
protected CheckSockets ( object eventState ) : void
eventState object
return void

CloseSocket() protected method

Remove the socket contained in the given state object from the connected array list and hash table, then close the socket
protected CloseSocket ( HttpSocket state ) : void
state HttpSocket
return void

Pause() protected method

protected Pause ( ) : void
return void

Start() public method

Spawn a thread that listens to incoming connections
public Start ( OnNewClient onConnection ) : void
onConnection OnNewClient
return void

StartListening() protected method

Open a listener socket and wait for connections
protected StartListening ( Socket &ListeningSocket ) : void
ListeningSocket Socket
return void

StartThread() protected method

protected StartThread ( ) : void
return void

Stop() public method

Stop the listening threads and close the client sockets
public Stop ( ) : void
return void

TcpServer() public method

Initialize, but do not start, a multi-threaded TCP server listening for localhost connections only
public TcpServer ( int localPort, bool bUseIPv6 ) : System
localPort int TCP port to listen to
bUseIPv6 bool /// If true, listen on ::1 only. If false, listen on 127.0.0.1 only. ///
return System

Property Details

ConnectedSockets protected_oe property

Set of open sockets, indexed by socket identifier
protected Dictionary ConnectedSockets
return HttpSocket>.Dictionary

LocalPort protected_oe property

Port used for local browser-proxy communication
protected int LocalPort
return int