Send CGI strings to IP Camera

I am using Processing 2.1 32bit.

I would like to send a CGI command to my IP Camera. This is typically handled by entering a string such as,

"http://192.168.21.71:2000/decoder_control.cgi?command=4&onestep=2;"

into my browser. I was able to get the command to work using the link() function, but I do not want command execution to open a browser window. I just need to send the command to the server. I also tried to use the processing.net library Client function example below. When I used this I received a Java error. Any ideas on how to send these types of commands?

Thanks!

// Example by Tom Igoe 
// Creates a client that sends input to a server

import processing.net.*; 
Client myClient; 
int clicks;

void setup() { 
  // Connect to the local machine at port 10002.
  // This example will not run if you haven't
  // previously started a server on this port.
  myClient = new Client(this, "http://192.168.21.71", 2000); 

} 

void mouseReleased() {
  // Tell the server:
  myClient.write("/decoder_control.cgi?command=4&onestep=2");
}

Answers

  • The IP declaration in my Client function call is getting garbled by the forum posting tool. It is a correct IP in my code and not the source of the problem. FYI.

  • Answer ✓

    "I received a Java error"
    And we must guess it, right? :-)

    In http://bazaar.launchpad.net/~philho/+junk/Processing/view/head:/_QuickExperiments/_Net/ParseGzippedXMLFromGET/ParseGzippedXMLFromGET.pde I have an example of requesting with GET a specific URL.

  • Ahh, sorry it was a late night and I was getting frustrated, I should have posted the error.

    I looked at your code, it makes sense. Thanks! It turns out my issue is that my client call was not connecting to the server. I need to find the correct address to connect the the server in the webcam. I've tried many options I've found online, myip/serverpush.htm, /directstream.htm, /snapshot.cgi. I can't seem to find the connection to the sever itself. Any tips on what I should be looking for?

  • edited January 2014

    camera is a Foscam 8910, for anyone who may have experience with this. As silly as it sounds, I've written loads of code for hardware interfacing, SPI, I2C, UDP, but I've never played with CGI scripts before so its frustrating that its stumping me.

    Thanks!

  • Hello, matrD! Did you ever achieve a final solution to your original problem? I'm trying to accomplish the same type of IP camera control as you.

Sign In or Register to comment.