Pages: [1]   Go Down
Author Topic: Python to Arduino via Ethernet Xport  (Read 578 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
       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:
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!

Pages: [1]   Go Up
Jump to: