Go Down

Topic: Python to Arduino via Ethernet Xport (Read 1 time) previous topic - next topic


I'm trying to send a simple test message from a python program to my arduino over ethernet. The arduino has an Xport ethernet shield from adafruit. I can't seem to get the arduino to receive the message.

Here is my Python script:
Code: [Select]
       print "sending TCP packets"
       port = 40000
       host = ""
       s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
       s.send('Hello, world')
       #s.sendto("Send complete!", (host,port))

Here is my basic wait function for my arduino:
Code: [Select]
uint16_t requested(void)
 uint8_t read, x;
 char *found;
 while (1) {
   read = xport.readline_timeout(linebuffer, 128, 200);
   //Serial.println(read, DEC);   // debugging output
   if (read == 0)     // nothing read (we timed out)
     return 0;
   if (read)          // we got something!
     Serial.println("Got something!");
With the Loop running that method every time.

This is what my Xport configuration screen looks like:

I've also tried adjusting the port forwarding settings on my router to forward everything to the arduino.

Anyone who's done something similar I would happy to know how you got it working. Thanks!

Go Up