equal
deleted
inserted
replaced
82 /* SDL_net does not seem to have a way to listen on a random unused port |
82 /* SDL_net does not seem to have a way to listen on a random unused port |
83 and find out which port that is, so let's try to find one ourselves. */ |
83 and find out which port that is, so let's try to find one ourselves. */ |
84 srand(time(NULL)); |
84 srand(time(NULL)); |
85 for(int i=0; !result->sock && i<1000; i++) { |
85 for(int i=0; !result->sock && i<1000; i++) { |
86 // IANA suggests using ports in the range 49152-65535 for things like this |
86 // IANA suggests using ports in the range 49152-65535 for things like this |
87 result->port = 49152+(rand()%(65535-49152)); |
87 result->port = 49152+(rand()%(65536-49152)); |
88 result->sock = listen(result->port); |
88 result->sock = listen(result->port); |
89 } |
89 } |
90 } |
90 } |
91 if(!result->sock) { |
91 if(!result->sock) { |
92 flib_log_e("Failed to create acceptor."); |
92 flib_log_e("Failed to create acceptor."); |