Shrink packet header size
This commit is contained in:
1 parent
c3906e7d60
commit
7b58ca0338
10 files changed
+140
-115
No files matched your search
@@ -17,21 +17,23 @@ namespace MistoxServer {
|
||||
public event EventHandler onFastReceive;
|
||||
public event EventHandler onDisconnected;
|
||||
|
||||
public ServerInterface( int port, ServerMode mode ) {
|
||||
FastUpdateServer = new mUDPClient( new IPEndPoint( IPAddress.IPv6Any, port ), mode );
|
||||
SlowUpdateServer = new mTCPListener( port, mode );
|
||||
public ServerInterface( int port ) {
|
||||
|
||||
// Initilize the server listening connections
|
||||
SlowUpdateServer = new mTCPListener( port );
|
||||
SlowUpdateServer.onConnected += OnConnected;
|
||||
FastUpdateServer.onReceived += ( object o, EventArgs e ) => { onFastReceive?.Invoke( o, e ); };
|
||||
SlowUpdateServer.onDisconnected += OnDisconnected;
|
||||
|
||||
FastUpdateServer = new mUDPClient( new IPEndPoint( IPAddress.Any, port ) );
|
||||
FastUpdateServer.onReceived += ( object o, EventArgs e ) => { onFastReceive?.Invoke( o, e ); };
|
||||
|
||||
Console.WriteLine( "The Server is initilized and waiting for clients to connect at port : " + port );
|
||||
}
|
||||
|
||||
void OnConnected( object sender, EventArgs e ) {
|
||||
Connection user = (Connection)sender;
|
||||
onConnected?.Invoke( sender, e );
|
||||
user.slowClient.onReceived+= ( object o, EventArgs e ) => { onSlowReceive?.Invoke( o, e ); };
|
||||
user.slowClient.onReceived += ( object o, EventArgs e ) => { onSlowReceive?.Invoke( o, e ); };
|
||||
user.slowClient.onDisconnected += OnDisconnected;
|
||||
Connections.Add( user );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user