i am doing some network programming:
i want to be able to switch lights in my house either on or off through the network,WAN.The lights are connected to a computer through the paralel port.i.e the computer is at home.i have achieved the control of the lights at LAN level.

my problem is:
1.accesing the remote computer through the gateway,because the nework programming only IP configuration of REMOTE COMPUTER,but not through another one. as in from public IP to Private IP in the LAN.;different location.please help

2.rerouting of the feedback to know the status of the lights.

Since you have already achieved control over your lights through your LAN, I am guessing you have some sort of listener (a kind of server) set up which actually listens to these requests on the PC where you have connected the lights on the serial port.

To achieve the same from a PC connected to the Internet but not in your LAN, you will need to set up Port forwarding on your Gateway machine.
In port forwarding "a port" on your local machine "is forwarded" to your gateway, such that any requests coming on that specific port on your gateway would be "forwarded" to a port of specific machine on your LAN.
For example :-
Assume "192.168.0.12" is the machine on which your program to switch off the lights is running and listening on port 8080 . Your gateway is "192.168.0.1" on LAN and "121.22.22.22" is its static IP.

Using port forwarding you can tell the gateway machine to forward whatever content it receives on port 8080 (on its Static IP) to forward it to port 8080 of the 192.168.0.12 machine.

Here is a small example of port forwarding, where the gateway is an ADSL Router and the machine to which content needs to be forwarded has Windows XP loaded on it.

Also once you have the socket connection established fro the remote machine, you can write the feedback back on the same socket.

thanks stephen84.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.