• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[SOLVED] UDP Ports

Hi, im creating various .exe servers in windows with the function:
Code:
SERVER_SOCKET = network_create_socket_ext(network_socket_udp,20000);
But as im going to create various servers i need differents port, how can i know which ports
are being used, so i dont use the same port for every program?
 
it looks like the same function with tcp works with udp so i used this:

Code:
port = 10000;
SERVER_SOCKET = -1;
while (SERVER_SOCKET < 0 and port <= 10500)
   {
    SERVER_SOCKET = network_create_socket_ext(network_socket_udp,port);
    if SERVER_SOCKET<0 {port++}
   }
it will loop trough ports until it find an unused port.
 
Top