Server browsing
Hi all
I've been wondering about a method to browse the network for open servers.
I thought of
1. Sending a broadcast message to the network
2. Scanning all IPs for servers
Drawback of #1:
I would have to use UDP for broadcasting, right?
Drawback of #2:
How can I find out the subnet mask of my network...
or even worse, when I'm connected to two networks, maybe the internet and a LAN. How can I find out what IP address space to use....
I would really apreciate any help from you.
And please don"t post "GOOGLE!" as I've been searching for information and just didn't find anything useful.
Thx in advance
--::[Madhed]::--
[edited by - MadHed on January 21, 2004 8:34:49 AM]
Interesting. Sounds like a network scanning application.
Be more specific on the target IP. For example, does the system that houses the application connected to the network? In other words, are you scanning a local network?
Kuphryn
Be more specific on the target IP. For example, does the system that houses the application connected to the network? In other words, are you scanning a local network?
Kuphryn
Greetings,
a quick search turned up that this sample project contains some code to enumerate all available computers in a network environment. I haven''t taken a look at it, just read it would contain that stuff.
However, I would let the user choose whether he''d like to play online or in a local network. If the latter is the case, use the code above and send a query to all enumerated computers on a certain port to see whether an instance of your game server is running. If the former is the case, on the other hand, I''d query a master server (just like UT2003 does, for instance).
- Christoph
---
Teamwork Software - Stuff That Does Something
a quick search turned up that this sample project contains some code to enumerate all available computers in a network environment. I haven''t taken a look at it, just read it would contain that stuff.
However, I would let the user choose whether he''d like to play online or in a local network. If the latter is the case, use the code above and send a query to all enumerated computers on a certain port to see whether an instance of your game server is running. If the former is the case, on the other hand, I''d query a master server (just like UT2003 does, for instance).
- Christoph
---
Teamwork Software - Stuff That Does Something
- Christoph---Hypotenubel.net Big Words Without Meaning | Jaic Wain The IRC client that never gets oldFlat Crap Not pushing 2D graphics to its limits | TWLog Keeping the world under surveillance
Hi all,
thx for your replies![](smile.gif)
@captain nuss:
Well, that''s not really what I was looking for.
It uses the windows network.
I''m just using plain Winsock
OK more specific:![](wink.gif)
I''m running a client on a machine And what I want to do is browse the network for open servers.
(Like in Counterstrike for example)
Ok, I''m just planing to scan the local network, becuase It would take a lot of time to browse the internet right?![](wink.gif)
- All I need is to find out my local address.
(bind just gives me 127.0.0.1, loopback
)
- I need to know if it''s local net or internet
- I need to know the subnet mask of the segment I''m in so I''m not scanning more servers than needed
(for example: my ip is 192.168.0.1, subnet is 255.255.255.0
then I would scan 192.168.0.1 -> 192.168.0.255)
And the big question? What if I''m connected to the internet AND lan? How do I find out the right address????
I will first let the user specify the ip range but later it would be nice to let the application fil in the right values.
Well thx in advance...
--::[Madhed]::--
thx for your replies
![](smile.gif)
@captain nuss:
Well, that''s not really what I was looking for.
It uses the windows network.
I''m just using plain Winsock
OK more specific:
![](wink.gif)
I''m running a client on a machine And what I want to do is browse the network for open servers.
(Like in Counterstrike for example)
Ok, I''m just planing to scan the local network, becuase It would take a lot of time to browse the internet right?
![](wink.gif)
- All I need is to find out my local address.
(bind just gives me 127.0.0.1, loopback
![](sad.gif)
- I need to know if it''s local net or internet
- I need to know the subnet mask of the segment I''m in so I''m not scanning more servers than needed
(for example: my ip is 192.168.0.1, subnet is 255.255.255.0
then I would scan 192.168.0.1 -> 192.168.0.255)
And the big question? What if I''m connected to the internet AND lan? How do I find out the right address????
I will first let the user specify the ip range but later it would be nice to let the application fil in the right values.
Well thx in advance...
--::[Madhed]::--
You should dive into networking a bit ![](tongue.gif)
There are two possibilities:
1: LAN
All IP addresses where the ip address is above 127, it is a local network. Get the subnet mask from the networking API you use, and broadcast!
2: Internet
Broadcasting == Flooding, DO NOT DO THAT. Ok, now that''s said: just use a master server, that all severs register with.
-
CL Game Studios. Probably.
![](tongue.gif)
There are two possibilities:
1: LAN
All IP addresses where the ip address is above 127, it is a local network. Get the subnet mask from the networking API you use, and broadcast!
2: Internet
Broadcasting == Flooding, DO NOT DO THAT. Ok, now that''s said: just use a master server, that all severs register with.
-
CL Game Studios. Probably.
Ok thx. ![](smile.gif)
Well I''m not insane...![](wink.gif)
I think the only real solution for the internet is a master-server. I know how to do that.
But for the local Network it would be nice to let the clients find the server by themselves. (Just to make that intention clear)
I may be dumb
but can anybody just name the functions to use.
I haven''t coded network applications for long so I''m still new to this topic.
(I''m using Winsock, the server/client code is already working perfectly, I just want to add that feature)
I just want to know how to Enum all the NICs on the computer so I can use the LAN adapter and not the ISDN adapter for example.
And how can I find out the local IP address and subnet mask of the network?
When i bind() a socket it''s just bound to 127.0.0.1 Nothing really to work with...
Maybe I''m just missing the point of your reply Sijmen, sorry if that''s so.
I know there has to be a function to do that... :D
![](smile.gif)
Well I''m not insane...
![](wink.gif)
I think the only real solution for the internet is a master-server. I know how to do that.
But for the local Network it would be nice to let the clients find the server by themselves. (Just to make that intention clear)
I may be dumb
![](sad.gif)
I haven''t coded network applications for long so I''m still new to this topic.
(I''m using Winsock, the server/client code is already working perfectly, I just want to add that feature)
I just want to know how to Enum all the NICs on the computer so I can use the LAN adapter and not the ISDN adapter for example.
And how can I find out the local IP address and subnet mask of the network?
When i bind() a socket it''s just bound to 127.0.0.1 Nothing really to work with...
Maybe I''m just missing the point of your reply Sijmen, sorry if that''s so.
I know there has to be a function to do that... :D
Yea, you are right to query a master server for internet games and use broadcast to search for local games. I would just have some choice the user makes where they can search for internet or local games and it executes the appropriate search code. It doesn't hurt you to use the wrong code for the wrong interface. Either the master server won't be found or your broadcast queries will be dropped at an edge router. Since you are unlikely to be sending more than a couple packets every few seconds, flooding isn't much of an issue.
To determine the local interfaces on your machine use WSAIoctl() with SIO_ADDRESS_LIST_QUERY for windows and ioctl() with SIOCGIFCONF for *nix.
[edited by - jermz on January 23, 2004 12:49:20 PM]
To determine the local interfaces on your machine use WSAIoctl() with SIO_ADDRESS_LIST_QUERY for windows and ioctl() with SIOCGIFCONF for *nix.
[edited by - jermz on January 23, 2004 12:49:20 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement