PipesServer.Start
Begins listening for client connections.
Remarks
Starts listening on a background task and returns immediately. The server accepts connections until PipesServer.Stop is called.
Attach event handlers before calling this. A client that connects before ClientConnected has a subscriber raises the event into nothing.
Because listening is handed to a background task, the server may not be up the instant this returns. PipesServer.IsRunning reports the actual state.
Syntax
| Syntax | Description |
|---|---|
| Start() | Starts the server. |
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
using Nova.IPC.Pipes;
PipesServer server = new PipesServer("NovaDemoServer");
// Subscribe before starting, or early connections are missed.
server.ClientConnected += connection =>
Console.WriteLine("Connected: " + connection.Name);
server.ClientDisconnected += connection =>
Console.WriteLine("Disconnected: " + connection.Name);
server.ClientMessage += (connection, message) =>
Console.WriteLine(connection.Name + " said: " + message.DecodeString());
server.Start();
This post is licensed under CC BY 4.0 by the author.