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
21
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
21
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
21
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
3
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
19
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.

Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 25th Apr 2023 12:05
Quote: "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."


Yes, I've read that But I can still run two apps simultaneously that both create a listener on the same port number, and neither fails, they both return an ID for the listener. However, only the first app is able to use the port, and the second app can only use the port when the first app is closed. This happens on both Linux and Windows.
13/0
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 29th Apr 2023 10:26 Edited at: 29th Apr 2023 10:27
Quote: "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."


I have an app that spawns helper apps, the helper apps need to know which port they can use. If I spawn, say, 4 helper apps all starting on port 6000, they send a message to the main app and the main app replies back to their IP and port but they all succeed on the same IP and port. This is on Ubuntu Tier 2. Furthermore, I just tested on Windows Tier 1 that I can create two listeners on the same IP and port in the same app, only the first listener can receive data but both listeners can send data.

EDIT: I moved to AppGameKit Studio btw to see if it was the same, it is.
13/0

Login to post a reply

Server time is: 2024-04-20 13:29:50
Your offset time is: 2024-04-20 13:29:50