Servers listen on a specific port and accept multiple clients.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Networking Server
DeltaEngine.Networking.Mocks MockServer
DeltaEngine.Networking.Tcp TcpServer
Namespace: DeltaEngine.Networking
Assembly: DeltaEngine.Networking (in DeltaEngine.Networking.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The Server type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Server | Initializes a new instance of the Server class |
Methods
Name | Description | |
---|---|---|
Dispose | ||
OnClientDataReceived | ||
RaiseClientConnected | ||
RaiseClientDisconnected | ||
Start |
Fields
Name | Description | |
---|---|---|
connectedClients |
Properties
Name | Description | |
---|---|---|
IsRunning | ||
ListenPort | ||
NumberOfConnectedClients |
Events
Name | Description | |
---|---|---|
ClientConnected | ||
ClientDataReceived | ||
ClientDisconnected |
Remarks
Examples
[Test] public void ListenForClients() { server.Start(800); Assert.IsTrue(server.IsRunning); }
[Test] public void InitiallyNoClients() { Assert.AreEqual(0, server.ListenPort); Assert.AreEqual(0, server.NumberOfConnectedClients); }
[Test] public void ConnectClient() { bool didClientConnect = false; server.ClientConnected += client => didClientConnect = true; CreateConnectedClient(); Assert.AreEqual(1, server.NumberOfConnectedClients); Assert.IsTrue(didClientConnect); }
See Also