Naanou.ResourceExchange
Class NaanouServerManager
Adds random port binding functionality to the usual ServerManagerAsync class
| Fields inherited from class ClintHeyer.Httpd.ServerManager |
|
url
|
| Property Summary |
| int |
Port
Gets port server is running on
|
| Properties inherited from class ClintHeyer.Httpd.ServerManager |
|
TicketIssuer, Url |
| Method Summary |
| void |
BindSocket(int port)
Binds the server to a port. If it cannot bind it picks a random port between port and BIND_RANDOM_MAX.
|
| Methods inherited from class ClintHeyer.Httpd.Context |
|
AddContext, AddResponseHandler, CanHandleRequest, GetContexts, GetResponseHandler, Handle, IConfigurable.Get, IConfigurable.GetBool, IConfigurable.GetFloat, IConfigurable.GetInt, IConfigurable.GetString, OnReplyCompleted, OnReplyCompletedEvent, OnReplyStarted, OnReplyStartedEvent, OnThrottleChange, OnThrottleChangeEvent, RemoveContext |
BIND_ATTEMPT_MAX
public int BIND_ATTEMPT_MAX
-
How many attempts should be made to bind to a port
BIND_RANDOM_MAX
public int BIND_RANDOM_MAX
-
Random number bound to be added to base port
NaanouServerManager
public NaanouServerManager(string address,
int basePort)
-
Constructor
Parameters:
-
address - IP address or hostname to advertise as the server address
-
basePort - Base port, or -1 for a random port
Port
public int Port
-
Gets port server is running on
BindSocket
protected void BindSocket(int port)
-
Binds the server to a port. If it cannot bind it picks a random port between port and BIND_RANDOM_MAX.
Parameters:
-
port - Port number, or -1 for a random port
Throws:
-
System.Net.Sockets.SocketException - If random port binding fails after BIND_ATTEMPT_MAX attempts.