SMTP protocol problems · Issue #65 · jcw/ethercard · GitHub


I’ve been looking at the possibility of sending SMTP (email) using Ethercard, however the way the current packetloop works doesn’t seem to be very compatible with SMTP.

I can get as far as the connection message being returned e.g. “220 SMTP server ready”,
by having a custom fill callback function, that doesn’t fill with anything.
and by setting persist_tcp_connection=true to stop the connection being immediately closed

However looking at the ACT sent in response to the connection message, the current packetloop sends [PSH,ACK] where normally SMTP just sends ACK

Even if I ignore this, the next step in the protocol is to send the “HELO” message using [PSH,ACK] however by this point the packetloop code seems very confused and setting tcp_client_state=2 and waiting for the next call to the buffer fill callback, doesn’t happen because the packetloop returns before it gets to the state==2 code 🙁

Can someone tell me whether the current packetloop is likely to be able to support a new protocol at all, or with minor modifications, or whether I would need to write my own packetloop (based heavily on the existing code) ?

PS. I’m an experienced programming, but have had no dealings with TCPIP before.

Looking at a working SMTP transfer the overall packet structure looks like this


TCP duplicate ACK (not sure why this happens)

PSH,ACK server sends connection message
ACK client ack to server connection message
PSH,ACK client sends HELO message
ACK server sends ACK for client ACK

etc etc

Source: SMTP protocol problems · Issue #65 · jcw/ethercard · GitHub

SMTP protocol problems · Issue #65 · jcw/ethercard · GitHub was last modified: July 13th, 2017 by Jovan Stosic