public final class NetcodeServerFactory
extends java.lang.Object
NetcodeServer,
RandomStringGenerator| Constructor and Description |
|---|
NetcodeServerFactory(int port)
Creates a new factory instance with a specified port number.
|
| Modifier and Type | Method and Description |
|---|---|
void |
runAfterBind(java.util.function.Consumer<java.net.ServerSocket> runner)
Adds a function to the post-bind queue.
|
void |
setAppIdValidator(java.util.function.Predicate<java.lang.String> appIdValidator)
Defines an application id validator.
|
void |
setChannelIdProvider(java.util.function.Supplier<java.lang.String> channelIdProvider)
Defines a generator for channel ids.
|
void |
setMaxClients(int max)
specifies the connection backlog.
|
void |
setMode(SocketMode socketMode,
SecurityMode securityMode)
Specifies both the socket mode and the security mode to use for new
connections.
|
NetcodeServer |
start()
Start the server
|
public NetcodeServerFactory(int port)
public void setMode(SocketMode socketMode, SecurityMode securityMode)
SocketMode.PLAIN, then the securityMode
must be set to SecurityMode.ANY.java.lang.IllegalArgumentException - an illegal combination has been providedjava.lang.NullPointerException - any parameter is nullpublic void runAfterBind(java.util.function.Consumer<java.net.ServerSocket> runner)
ServerSocket or
SSLServerSocket as soon as it is created (but for SSLSockets
before the handshake). This allows arbitrary modification of the socket
configuration. This is especially useful for SSLServerSockets where more
control over the security configuration may be desired.
If the socket mode is set to SocketMode.PLAIN, the passed socket
will be of type ServerSocket, for all other modes it will be a
SSLServerSocket.runner - the runner to add to the post-bind queue. may not be null.public void setMaxClients(int max)
ServerSocket.ServerSocket(int, int)public NetcodeServer start() throws java.io.IOException
java.io.IOExceptionpublic void setAppIdValidator(java.util.function.Predicate<java.lang.String> appIdValidator)
appIdValidator - may not be null.public void setChannelIdProvider(java.util.function.Supplier<java.lang.String> channelIdProvider)
appIdValidator - may not be null.Copyright © 2018. All Rights Reserved.