Socket programming with TCP using Micropython in ESP8266

Keywords: Socket, Socket programming, TCP/UDP

Continuation to🤔socket programming. There are two widely used Socket types, stream sockets, and datagram sockets. Stream sockets treat communications as a continuous stream of characters, while datagram sockets have to read entire messages at once. Each uses its own communications protocol. Stream sockets use TCP (Transmission Control Protocol), which is a reliable, stream oriented protocol, and datagram sockets use UDP (Unix Datagram Protocol), which is unreliable and message oriented.

TCP socket runs on top of IP (Internet Protocol). TCP is a connection-oriented communication protocol. What is this connection-oriented🤔? Connection-oriented communication is a network communication in which temporary connection must be established before any data is transferred and data stream is delivered in the same order as it was sent. I personally worked on TCP so I ‘rely’ on this protocol as it provides for the recovery of segments that get lost, are damaged, duplicated or received out of their correct order. Lets learn how to write Micropython code to download data from the internet.

TCP Applications

Here are few real-time applications of TCP

  1. FTP
  2. SMTP
  3. Telnet

Prerequisites:

  • ESP8266 hardware
  • uPyCraftIDE

Here is the output of the above code.

To have more fun you can try the telnet servers to download the data.

THANK YOU and many more posts coming your way!

Please put your queries in comment section, I will get back to you with answers ASAP.
Please like and share Techawarey. Find and Like Techawarey on Facebook.😊

Related posts

Leave a comment....