Sign in to follow this  

Network programming noob question

This topic is 2847 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

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 )

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites

This topic is 2847 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this