Go Down

Topic: Getting data sent by Wifly into processing (port 80) (Read 1 time) previous topic - next topic

Rubeix

Hello,

I'm trying to get data from local port 80 into my processing sketch but it is not working. I connect my wifly with an adhoc network and send some data into port 80.
When i put on my browser my host ip and local port (something like 169.254.186.203:80) i can see what was sent to the local port. So I tryed do get that into processing using the following simple WebClient sketch, but it doen't work.

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

void setup() {
  size(200, 200);
  // Connect to the local machine at port 80.
  // This example will not run if you haven't
  // previously started a server on this port
  myClient = new Client(this, "169.254.186.203", 80); //my ip and local port
}

void draw() {
  if (myClient.available() > 0) {
    dataIn = myClient.read();
  }
  background(dataIn);
}

Somebody can help me with this??

Thanks in advance

johnwasser

On a TCP/IP connection, one side acts as a Client and the other side acts as a Server.  Your Processing sketch should act as one and your Arduino sketch should act as the other.  Does your Arduino sketch act as a Server or Client?
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp
See who has no social life: https://forum.arduino.cc/index.php?action=stats :)

Go Up