Click to See Complete Forum and Search --> : TCP server


000dreamsound000
July 16th, 2007, 08:26 AM
Hi
I am working on a security network camera system as part of a summer project of mine. The camera allows use of a TCP server for event configuration. I have coded a simple TCP server (C++) which beeps and accesses the camera interface (through a web browser) when a switch connected to the camera is pressed.
The problem I am having is the server has to run on two different machines i.e one downstairs and one upstairs. Ideally the browser should open only in the downstairs machine else if it is off or unavailable it should then open in the upstairs machine. This is where I am stuck. The idea I have is to first obtain the IP of the local machine where the server is running.
Thus if the IP is that of the downstairs machine only the browser will open only in the downstairs machine and not the upstairs machine and vice versa.
So I can obtain the IP adress of the local machine but do not know how to make use of it. Simple if statements do not work because the I don't know how to convert the IP to an int.
Hope this make sense and somebody can help.
Any other method of achieving a similar result will also be very helpful.

Thanks
Sandeep
PS My programming skills aren't great...

henky@nok.co.id
July 17th, 2007, 12:38 AM
I don't understand your explanation exactly. But if you mean that
you want to convert IP dotted address into integer, you can use
inet_addr() function. The return value is unsigned long data type.