Go Down

Topic: SerialIP and tcp connection starting from Arduino (Read 968 times) previous topic - next topic


I'm playing with SerialIP library and it works fine using Arduino as server (I have successful tested the HelloWorldServer example), but when I try to use Arduino as client it not open the connection.
I'm using the  SendEMail example and I'm able to ping Arduino, but it not open any connection (on mail server side I have check with tcpdump)
I have also added some print on smtp_send (note that mail is send via Serial1 of Arduino Mega 2560 board and I use Serial0 as debug)
Code: [Select]

unsigned char smtp_send(uip_ipaddr_t *smtpserver,
 const char *to, const char *from, const char *msg, uint16_t msglen)
 struct uip_conn *conn;

 // Open a connection to the SMTP server on TCP port 25.
 conn = uip_connect(smtpserver, HTONS(25));
 if (conn == NULL) {
   // Too many concurrent outgoing connections.  Should never happen
   // unless you have multiple connections open at the same time.
   debug("Too many c'ns   ");
   return 0;

 // If we're here then uip_connect() was able to schedule the connection.
 // The actual connect attempt will happen later, and uip_callback will
 // be notified when it succeeds.
 debug("Connect sched ok");
  Serial.println("remote addr");
  Serial.println("Detected a connection");
  Serial.println("local port");
  Serial.println("remote port");

 // Allocate the input buffer, like in the Hello World example.
 PSOCK_INIT(&s.psock, s.inputbuffer, sizeof(s.inputbuffer));

 // Save the message that we'll send so we can access it later from
 // within smtp_thread().
 s.to = to;
 s.from = from;
 s.msg = msg;
 s.msglen = msglen;

 return 1;

and the result is

remote addr
Detected a connection
local port
remote port

The same prints in HelloWorldServer test are correct (remote ip, remote port and local port)
It seems that is try to connect to another ip and port and this explain why I cannot see any connection to the mail server.
Any idea ?
Thank you


I don't know anything about that library. Do you have any complete examples of client code that you can test? I notice that you're handling network byte ordering for the transport layer in the application code but not for the network layer, and I suggest you check whether that's right. I would have expected the library to deal with byte ordering issues within the API.


you can see the example inside the SerialIP library http://playground.arduino.cc/Code/SerialIP
Inside the SerialIP-1.0.zip there's the example SendEMail.pde


What OS is running on the PC that your SLIP interface is connected to?


The OS is Debian Linux 7.5 and the firewall is disabled

Go Up