Jump to content
  • Advertisement
Sign in to follow this  
Key_46

[C++] The Basics help: LAN and Internet clients/servers

This topic is 3965 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i am starting with the Sockets programming and i need some info about some things: 1) How to get my IP: Ok, i can use IPCONFIG in MSDOS but how i can do this with my app... 1a) I use a internet router, so, i have a internet IP and a Intranet IP, how i can get both. 2) LAN Games, how can i scan computers in the intranet to find servers? i know that my intranet IP is 192.168.1.3, all intranets are 192.168.1.x? 2a)What is the maximum number of computers that can be connected in a intranet? it goes from XXX.XXX.XXX.1 to XXX.XXX.XXX.999? in my case the router is XXX.XXX.XXX.1, it will be aways like this? Thanks, Caian.

Share this post


Link to post
Share on other sites
Advertisement
1) don't bother. Your local address is useless.

1a) same as (1)

2) Don't scan - use a UDP socket and broadcast to the ipaddress 255.255.255.255 on a given port. All machines on the local network with your program can respond with a packet.

2a) well, most routers will likely one leave a single octet, which is 8 bits or 0-255 hosts. Better to use the broadcast method, not to port scan.

For the answer to (1), the most common solution is to have a third machine on the internet. The machine can be used to mediate between two peers. A resource for this is here. The author (who is the friendly moderator of the network forum) also has a library that achieves the same.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!