Network programming noob question

Started by
5 comments, last by hplus0603 14 years, 1 month ago
The tutorial I'm reading leads me to believe that a network address translation (NAT) due to a firewall is keeping me from making a small program and then testing it with a friend off of my LAN (I can't hardcode the IP found in ipconfig). Obviously there must be a way around this since I play online games all the time. Is this a complicated issue that I (as a networking noob) can't/shouldn't tackle at this point? I'd really find this more interesting if I could make something that I wasn't looping back to myself... ( and I don't know anything about firewalls so I won't be tinkering with that I think :-P )
Advertisement
You can create a port mapping on your router if you need to accept incoming connections. Generally routers will block all incoming traffic on all ports. You can configure the router to pass incoming requests on port ? to the IP address assigned to your machine.

e.g. Pass all incoming traffic on port 81 to IP 192.168.1.23

IF you set your router up to accept incoming traffic, then your friend can connect to your computer (initiate the connection [friend -> you]). He would have to do the same if you plan on initiating the connection [you -> friend]. You only need to do this on your router if you always have your friend initiate the connection.

Some routers are pre setup for games, and others may recognize the traffic. If the game uses TCP then this is not an issue as the game client establishes the connection. As for UDP I am not sure if there is a way to auto map. I believe in this case you would need to open up a port as it is a connectionless protocol. I may be wrong on this last point...
∫Mc
The router settings seem to be the only way to get through, but the 192.168.x.x format is a special IP to loop back to your own network right? So, if I look at my ipconfig and see 192.168.x.x and hardcode that into my program for my friend, then it will basically look for that IP on his own network most likely right? Don't I need my "external" IP? How can I get that?
Moving to the Multiplayer/Networking forum.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Quote:Original post by Timptation
The router settings seem to be the only way to get through, but the 192.168.x.x format is a special IP to loop back to your own network right? So, if I look at my ipconfig and see 192.168.x.x and hardcode that into my program for my friend, then it will basically look for that IP on his own network most likely right? Don't I need my "external" IP? How can I get that?


No, that isn't a special IP, all networks do not have 192.168.x.x, however most home networks default to something similar to this.

www.whatismyip.com will give you your external IP. If you hardcode that in and you have a dynamic IP it will be very annoying so you might want to allow your friend to just type in an IP that you give him, whenever you want to test your program.

Engineering Manager at Deloitte Australia

You can use DynDNS to let the client find the server (you PC) even if it has not a fixed IP-address.
192.168 (and 172.xx and 10.xx) are prefixes for "private" networks -- they are not routable outside of a know private context. Thus, any such address is only valid on the network where it's used. Sending that address to your friend won't do him any good, unless you happen to be sharing the same private network.

What you're looking for is most likely "port forwarding," which has some links in the Forum FAQ (and some of the answers here will also help you in that regard).
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement