Xarky wrote:
Hi,
I am writing a small client server program. Now my computer is
connected to a router, and is going to run as the server program.
Since the router generates IPs for the computers connected to it, what
IP should be given to the client...or how can I get around this
problem.
When I enter the site www.whatip.com - the ip assigned by my ISP is
given but when I type iconfig in command prompt, the ip assigned by
the router is given.
Can someone help me out.
Thanks in Advance
Ok, Xarky, let me try to help you here:
First, you connect to the internet thru a router, so the ip address you
see when you go to
www.whatip.com is your router's ip address, assigned
by your Internet Provider, and it's the ip address your network is seen
from outside.
The ip address which you see when you execute ipconfig is the actual ip
address of your computer in your local network, assigned to you by your
DHCP server. This ip address usually starts from 192.168.*.* or 10.1.*.*
and is NOT seen from outside your network.
That was some intro to make sure we are on the same page.
Now, you are running some server on your computer and want to provide
access to this server for people from internet, right?
In this case you can either make your computer a DMZ, so that all
traffic will be forwarded to it, but it's not really secure.
Or you can just setup a port forwarding on your router to your computer
by your server port.
EG. if your server is running on port 8080 and your computer's internal
ip is 192.168.1.5, then in the router settings you set forwarding of
incoming traffic for port 8080 to 192.168.1.5.
So this way, anybody who tries to access your server should type the
routers ip address (the one you see on
www.whatip.com) and your router
will re-route that traffic to your machine
(Make sure that clients for that server connect to server's listening port)
That's about it...
Maybe too watery, but hope it still helps :)
Andrey