TCP/IP Lean: Web Servers for Embedded Systems, Second Edition

Although I have already discussed one microcontroller TCP implementation, it was restricted to server use only. It could not be used for client software, such as an SMTP (Simple Mail Transfer Protocol) client to send emails or a POP3 (Post Office Protocol 3) client to fetch emails from a server.
The fundamental problem with running TCP/IP on a microcontroller with minimal RAM is that, in order to make a reliable network connection, TCP must be able to retransmit any data that goes astray. How can TCP retransmit a 1Kb message when it has only 300 bytes of RAM to store that message in? The previous TCP stack circumvented the problem in a manner that severely restricted its versatility, so that it could only be used for small server applications.
This chapter takes the TCP stack one step further and makes it much more versatile. By way of demonstration, an SMTP client is created that can send a complete email on demand. I have also included a POP3 client that can scan a mailbox and extract specific information from the messages in it (e.g., the sender's address and the subject line).
The new TCP stack enables a wide range of TCP applications on the microcontroller while keeping the RAM usage as small as possible.
The previous TCP implementation minimized RAM usage in all possible areas. Instead of creating a TCP message using a structure in RAM, it is created as needed in a small (42-byte) transmit buffer.