Searching
BlitzMax Forums/BlitzMax Beginners Area/Searching
| ||
Is there a fast way to search through all LAN IP's to find and see if someone has a server started? Thanks! |
| ||
Not without threads... you'll have to attempt to connect to each IP in your subnet to find a server, and since network calls are blocking , it will take a long time if you can't spin of the requests into seperate threads. ...Which you can't at this time, unfortunately. |
| ||
Which you can if you use a different language and create a dll / so that does this and that will give you back a list of found servers if you query the list back at a later point (after you checked if it finished the search) |
| ||
I would do it vise versa. Let the server announce his "state" on the broadcast-address. (this is mostly xxx.xxx.xxx.255, so 192.169.0.255). Then all local PCs will get the packet. Reading it and knowing the sender, they now know about the existence of a already started server. bye MB |
| ||
Or if it is your own server/client then you can always use something like Bonjour or a similar discovery service to have the server broadcast its presence. |
| ||
Actually the Client should broadcast that it's looking for a server, and the server should then respond to such broadcasts. (this is mostly xxx.xxx.xxx.255, so 192.169.0.255). That's because most subnets have 8 subnet bits, but it is a dangerous assumption (as 16 is becoming more commonplace).The broadcast address is always the highest address in the subnet. Personally I don't think it's a particularly good idea to have a server spaming the network with broadcast messages. |