Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / CreateUDPListener, how fast will it tell if it failed?

Author
Message
Cybermind
Valued Member
20
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 10th Oct 2022 11:58
When creating a UDP Listener, if the port chosen is not available, will it fail immediately and return an ID of zero that instant, so right on the next line I could try another port?
13/0
Cybermind
Valued Member
20
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 14th Oct 2022 09:46
I just tried to test it, I can create two UDP listeners on the same port, but neither fails and returns an ID. I also tested an app with two listeners on two different ports, the app can send data to both listeners, however, starting another instance of the same app also successfully creates two listeners, but they don't receive any data until I close the first instance of the app. Shouldn't they fail if the ports are already occupied?



13/0
Cybermind
Valued Member
20
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 1st Jan 2023 20:56
Any news on this? It is rather important that the app knows if the port is occupied or not.
13/0
Game_Code_here
2
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 1st Jan 2023 21:16
From the help files

The port value must be in the range 1 to 65535, although values below 1024 are likely to be protected by the operating system. If the port is already occupied then this command will fail and return 0.
smerf
18
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 5th Jan 2023 15:08
cybermind id like to just point out first that 1 udp listener is enough to run a server on or a database, Also there is no time delay between ur 2 listeners being created, Both will be executed before either can return a value there is prolly .00001 seconds between the 2 lines being executed. If your code at runs at 60 fps is should know by the time ur next framerate happens 0.016 seconds or something pretty fast. That would be 16 ms roughly but before agk knows its blocked. will be based on loop speed but it not necessary to scan that fast.

Login to post a reply

Server time is: 2023-04-01 11:23:55
Your offset time is: 2023-04-01 11:23:55