Result = CreateNetworkServer(#Server, Port [, Mode [, BindedIP$]])Description
Create a new network server on the local computer using the specified port.
#Server A number to identify the new server. #PB_Any can be used to auto-generate this number. Port The port to use for the server. Port values can range from 6000 to 7000 (this is a recommended area space, but it can go from 0 to 65000 in reality). Mode (optional) Can be one of the following values:#PB_Network_TCP: The server will use the TCP network protocol (default) #PB_Network_UDP: The server will use the UDP network protocolcombined with one of the following values (using the '|' operand):#PB_Network_IPv4: create a server using IPv4 (default) #PB_Network_IPv6: create a server using IPv6 BindedIP$ (optional) The local IP address to bind the server. By default, the server is created on all available local interfaces, and accept connections from them. It can be useful to restrict the server to only one interface (for example "127.0.0.1") to avoid connection attempt from other interfaces. On Windows, binding only to the localhost avoid to trigger the built-in firewall.
Returns nonzero if the server was created successfully and zero if creation failed, for example, due to the port being already in use. If #PB_Any was used as the #Server parameter then the generated number is returned on success.
Any number of servers can run simultaneously on the same computer, the only restriction being that two servers can not run using the same port and the same protocol (#PB_Network_TCP and #PB_Network_UDP). It's possible to create two servers using the same port, one using IPv4 and the other using IPv6. NetworkServerEvent() can be used to monitor server for events.
InitNetwork() must be called before using any other commands from the network library.
OpenNetworkConnection(), CloseNetworkServer(), NetworkServerEvent(), InitNetwork()