SlideShare uma empresa Scribd logo
1 de 30
www.techvilla.org.in
1
TECHVILL
A
www.techvilla.org.in
www.techvilla.org.in
Wifi Modem ESP8266
www.techvilla.org.in
Wifi modem esp8266
• The ESP8266 is a low cost Serial-to-WiFi module that interfaces nicely to any
microcontroller.
• The ESP8266 has a fullTCP/UDP stack support.
• It can also be easily configured as a web server.The module accepts commands via a
simple serial interface. It then responds back with the operation's outcome
(assuming everything is running correctly).
• Once the device is connected and is set to accept connections, it will send
unsolicited messages whenever a new connection or a new request is issued.
www.techvilla.org.in
Testing the module via FTDI (or a USB-to-Serial
cable)
• the module is not designed for more than 3.6V, so a 3.3V power supply should be used - both
for power and logic.
• The typical operating voltage is 3.3V (acceptable range is 1.7V to 3.6V). As the module can
draw up to 200 to 300mA peak power, make sure the power supply can deliver at least 300mA.
For example, the 3.3V line from a USB-serial cable would be barely sufficient, in that case it’s
better to use a LDO to derive 3.3V from the 5V line.
• When using the module with a 5V microcontroller, such as a standard Arduino, make sure to
use a level shifter on the URXD pin — a simple resistor-zener level shifter is sufficient. Again,
this is to prevent over-voltage.
www.techvilla.org.in
TOP view schematic
www.techvilla.org.in
BASIC COMMANDS
• AT+RST ----restart the module
• AT+CWMODE—wifi mode
• AT+CIPSTATUS—get the connection status
• AT+CIPSEND -- send data
• AT+CIPCLOSE---close theTCP/UDP connection
www.techvilla.org.in
TCP/IP protocol family
• IP : Internet Protocol
• UDP : User Datagram Protocol
• RTP, traceroute
• TCP : Transmission Control Protocol
• HTTP, FTP, ssh
www.techvilla.org.in
What is an internet?
• A set of interconnected networks
• The Internet is the most famous example
• Networks can be completely different
• Ethernet, ATM, modem, …
• (TCP/)IP is what links them
www.techvilla.org.in
What is an internet? (cont)
• Routers (nodes) are devices on multiple networks that pass traffic
between them
• Individual networks pass traffic from one router or endpoint to another
• TCP/IP hides the details as much as possible
www.techvilla.org.in
ISO/OSI Network Model
• Seven network “layers”
• Layer 1 : Physical – cables
• Layer 2 : Data Link – ethernet
• Layer 3 : Network – IP
• Layer 4 : Transport – TCP/UDP
• Layer 5 : Session
• Layer 6 : Presentation
• Layer 7 : Application
www.techvilla.org.in
TCP/IP Network Model
• Different view – 4 layers
• Layer 1 : Link (we did not look at details)
• Layer 2 : Network
• Layer 3 : Transport
• Layer 4 : Application
www.techvilla.org.in
OSI and Protocol Stack
OSI: Open Systems Interconnect
OSI Model TCP/IP Hierarchy Protocols
7th
Application Layer
6th
Presentation Layer
5th
Session Layer
4th
Transport Layer
3rd
Network Layer
2nd
Link Layer
1st
Physical Layer
Application
Layer
Transport Layer
Network Layer
Link Layer
Link Layer : includes device driver and network interface card
Network Layer : handles the movement of packets, i.e. Routing
Transport Layer : provides a reliable flow of data between two hosts
Application Layer : handles the details of the particular application
www.techvilla.org.in
Packet Encapsulation
 The data is sent down the protocol stack
 Each layer adds to the data by prepending headers
22Bytes 20Bytes 20Bytes 4Bytes
64 to 1500 Bytes
www.techvilla.org.in
IP
• Responsible for end to end transmission
• Sends data in individual packets
• Maximum size of packet is determined by the networks
• Fragmented if too large
• Unreliable
• Packets might be lost, corrupted, duplicated, delivered out of order
www.techvilla.org.in
IP addresses
• 4 bytes
• e.g. 163.1.125.98
• Each device normally gets one (or more)
• In theory there are about 4 billion available
www.techvilla.org.in
Routing
• How does a device know where to send a packet?
• All devices need to know what IP addresses are on directly attached networks
• If the destination is on a local network, send it directly there
www.techvilla.org.in
Routing (cont)
• If the destination address isn’t local
• Most non-router devices just send everything to a single local router
• Routers need to know which network corresponds to each possible IP address
www.techvilla.org.in
Allocation of addresses
• Controlled centrally by ICANN
• Fairly strict rules on further delegation to avoid wastage
• Have to demonstrate actual need for them
• Organizations that got in early have bigger allocations than they really
need
www.techvilla.org.in
IP packets
• Source and destination addresses
• Protocol number
• 1 = ICMP, 6 = TCP, 17 = UDP
• Various options
• e.g. to control fragmentation
• Time to live (TTL)
• Prevent routing loops
IP DatagramVers Len TOS Total Length
Identification Flags Fragment Offset
TTL Protocol Header Checksum
Source Internet Address
Destination Internet Address
Options... Padding
Data...
0 4 8 16 19 24 31
Field Purpose
Vers IP version number
Len Length of IP header (4 octet units)
TOS Type of Service
T. Length Length of entire datagram (octets)
Ident. IP datagram ID (for frag/reassembly)
Flags Don’t/More fragments
Frag Off Fragment Offset
Field Purpose
TTL Time To Live - Max # of hops
Protocol Higher level protocol (1=ICMP,
6=TCP, 17=UDP)
Checksum Checksum for the IP header
Source IA Originator’s Internet Address
Dest. IA Final Destination Internet Address
Options Source route, time stamp, etc.
Data... Higher level protocol data
We only looked at the IP addresses, TTL and protocol #
www.techvilla.org.in
IP Routing
• RoutingTable
Destination IP address
IP address of a next-hop router
Flags
Network interface specification
Application
Transport
Network
Link
Application
Transport
Network
Link
Network
Link
Source Destination
Router
www.techvilla.org.in
UDP
• Thin layer on top of IP
• Adds packet length + checksum
• Guard against corrupted packets
• Also source and destination ports
• Ports are used to associate a packet with a specific
application at each end
• Still unreliable:
• Duplication, loss, out-of-orderness possible
UDP datagram
Destination PortSource Port
Application data
0 16 31
ChecksumLength
Field Purpose
Source Port 16-bit port number identifying originating application
Destination Port 16-bit port number identifying destination application
Length Length of UDP datagram (UDP header + data)
Checksum Checksum of IP pseudo header, UDP header, and data
www.techvilla.org.in
Typical applications of UDP
• Where packet loss etc is better handled by the application than the network stack
• Where the overhead of setting up a connection isn’t wanted
• VOIP
• NFS – Network File System
• Most games
www.techvilla.org.in
TCP
• Reliable, full-duplex, connection-oriented, stream delivery
• Interface presented to the application doesn’t require data in individual packets
• Data is guaranteed to arrive, and in the correct order without duplications
• Or the connection will be dropped
• Imposes significant overheads
www.techvilla.org.in
Applications of TCP
• Most things!
• HTTP, FTP, …
• Saves the application a lot of work, so used unless there’s a good
reason not to
www.techvilla.org.in
TCP implementation
• Connections are established using a three-way handshake
• Data is divided up into packets by the operating system
• Packets are numbered, and received packets are acknowledged
• Connections are explicitly closed
• (or may abnormally terminate)
www.techvilla.org.in
TCP Packets
• Source + destination ports
• Sequence number (used to order packets)
• Acknowledgement number (used to verify packets are received)
TCP SegmentDestination Port
Acknowledgment Number
Options... Padding
Data...
0 4 10 16 19 24 31
Source Port
WindowLen
Sequence Number
Reserved Flags
Urgent PointerChecksum
Field Purpose
Source Port Identifies originating application
Destination Port Identifies destination application
Sequence Number Sequence number of first octet in the segment
Acknowledgment # Sequence number of the next expected octet (if ACK flag set)
Len Length of TCP header in 4 octet units
Flags TCP flags: SYN, FIN, RST, PSH, ACK, URG
Window Number of octets from ACK that sender will accept
Checksum Checksum of IP pseudo-header + TCP header + data
Urgent Pointer Pointer to end of “urgent data”
Options Special TCP options such as MSS and Window Scale
You just need to know port numbers, seq and ack are added
www.techvilla.org.in
TCP : Data transferHostClient
Send Packet 1
Start Timer
Retransmit Packet1
Start Timer
Packet should arrive
ACK should be sent
ACK would normally
Arrive at this time
Receive Packet 1
Send AXK 1
Time Expires
Receive ACK 1
Cancel Timer
Packet Lost
Timer
Timer

Mais conteúdo relacionado

Mais procurados

Arp and rarp
Arp and rarpArp and rarp
Arp and rarp
1991shalu
 

Mais procurados (20)

Wireshark tutorial
Wireshark tutorialWireshark tutorial
Wireshark tutorial
 
Wireshark tutorial
Wireshark tutorialWireshark tutorial
Wireshark tutorial
 
Chapter 2.1 : Data Stream
Chapter 2.1 : Data StreamChapter 2.1 : Data Stream
Chapter 2.1 : Data Stream
 
Network Address Translation (NAT)
Network Address Translation (NAT)Network Address Translation (NAT)
Network Address Translation (NAT)
 
Nad710 Network Address Translation
Nad710   Network Address TranslationNad710   Network Address Translation
Nad710 Network Address Translation
 
Chap2. ipv4-arp-icmp
Chap2. ipv4-arp-icmpChap2. ipv4-arp-icmp
Chap2. ipv4-arp-icmp
 
Computer networks protocols
Computer networks protocolsComputer networks protocols
Computer networks protocols
 
Network testing and debugging
Network testing and debuggingNetwork testing and debugging
Network testing and debugging
 
Packet analysis using wireshark
Packet analysis using wiresharkPacket analysis using wireshark
Packet analysis using wireshark
 
Troubleshooting Network and Network Utilities
Troubleshooting Network and Network UtilitiesTroubleshooting Network and Network Utilities
Troubleshooting Network and Network Utilities
 
Ip v4 & ip v6
Ip v4 & ip v6Ip v4 & ip v6
Ip v4 & ip v6
 
Wireshark
WiresharkWireshark
Wireshark
 
Wireshark Tutorial
Wireshark TutorialWireshark Tutorial
Wireshark Tutorial
 
Building day 2 upload Building the Internet of Things with Thingsquare and ...
Building day 2   upload Building the Internet of Things with Thingsquare and ...Building day 2   upload Building the Internet of Things with Thingsquare and ...
Building day 2 upload Building the Internet of Things with Thingsquare and ...
 
Wireshark Inroduction Li In
Wireshark Inroduction  Li InWireshark Inroduction  Li In
Wireshark Inroduction Li In
 
Chap 1 Network Theory & Java Overview
Chap 1   Network Theory & Java OverviewChap 1   Network Theory & Java Overview
Chap 1 Network Theory & Java Overview
 
Arp and rarp
Arp and rarpArp and rarp
Arp and rarp
 
Presentation on arp protocol
Presentation on arp protocolPresentation on arp protocol
Presentation on arp protocol
 
Internet layer security protocol & IPsec
Internet layer security protocol & IPsecInternet layer security protocol & IPsec
Internet layer security protocol & IPsec
 
Chapter 2 : Inet Address & Data Stream
Chapter 2 : Inet Address & Data StreamChapter 2 : Inet Address & Data Stream
Chapter 2 : Inet Address & Data Stream
 

Semelhante a WIFI MODEM Part-22

tcpip.ppt
tcpip.ppttcpip.ppt
tcpip.ppt
GauravSankhyan4
 
Internet protocols Report Slides
Internet protocols Report SlidesInternet protocols Report Slides
Internet protocols Report Slides
Bassam Kanber
 
chapter-4-networking hjgjjgj did hfhhfhj
chapter-4-networking hjgjjgj did hfhhfhjchapter-4-networking hjgjjgj did hfhhfhj
chapter-4-networking hjgjjgj did hfhhfhj
AmitDeshai
 

Semelhante a WIFI MODEM Part-22 (20)

tcpip.ppt
tcpip.ppttcpip.ppt
tcpip.ppt
 
tcpip.ppt
tcpip.ppttcpip.ppt
tcpip.ppt
 
tcpip.ppt
tcpip.ppttcpip.ppt
tcpip.ppt
 
tcpip.ppt
tcpip.ppttcpip.ppt
tcpip.ppt
 
Introduction to TCP / IP in networking Technology
Introduction to TCP / IP in networking TechnologyIntroduction to TCP / IP in networking Technology
Introduction to TCP / IP in networking Technology
 
tcpip.ppt
tcpip.ppttcpip.ppt
tcpip.ppt
 
Ismail TCP IP.pdf
Ismail TCP IP.pdfIsmail TCP IP.pdf
Ismail TCP IP.pdf
 
Ismail TCP IP.pdf
Ismail TCP IP.pdfIsmail TCP IP.pdf
Ismail TCP IP.pdf
 
Internet protocols Report Slides
Internet protocols Report SlidesInternet protocols Report Slides
Internet protocols Report Slides
 
Internetworking
InternetworkingInternetworking
Internetworking
 
TCP/IP Protocols
TCP/IP ProtocolsTCP/IP Protocols
TCP/IP Protocols
 
Tcpip 1
Tcpip 1Tcpip 1
Tcpip 1
 
Computer network coe351- part2- final
Computer network coe351- part2- finalComputer network coe351- part2- final
Computer network coe351- part2- final
 
QSpiders - Upper layer-protocols
QSpiders - Upper layer-protocolsQSpiders - Upper layer-protocols
QSpiders - Upper layer-protocols
 
chapter-4-networking hjgjjgj did hfhhfhj
chapter-4-networking hjgjjgj did hfhhfhjchapter-4-networking hjgjjgj did hfhhfhj
chapter-4-networking hjgjjgj did hfhhfhj
 
presentation on TCP/IP protocols data comunications
presentation on TCP/IP protocols data comunicationspresentation on TCP/IP protocols data comunications
presentation on TCP/IP protocols data comunications
 
ADDRESSING PADA TCP IP
ADDRESSING PADA TCP IPADDRESSING PADA TCP IP
ADDRESSING PADA TCP IP
 
TCP/IP
TCP/IPTCP/IP
TCP/IP
 
09 Systems Software Programming-Network Programming.pptx
09 Systems Software Programming-Network Programming.pptx09 Systems Software Programming-Network Programming.pptx
09 Systems Software Programming-Network Programming.pptx
 
Ch 2: TCP/IP Concepts Review
Ch 2: TCP/IP Concepts ReviewCh 2: TCP/IP Concepts Review
Ch 2: TCP/IP Concepts Review
 

Mais de Techvilla

Mais de Techvilla (20)

Raspberry pi Part 26
Raspberry pi Part 26Raspberry pi Part 26
Raspberry pi Part 26
 
Raspberry pi Part 25
Raspberry pi Part 25Raspberry pi Part 25
Raspberry pi Part 25
 
Raspberry pi Part 24
Raspberry pi Part 24Raspberry pi Part 24
Raspberry pi Part 24
 
Raspberry pi Part 23
Raspberry pi Part 23Raspberry pi Part 23
Raspberry pi Part 23
 
Raspberry pi Part 22
Raspberry pi Part 22Raspberry pi Part 22
Raspberry pi Part 22
 
Raspberry pi Part 21
Raspberry pi Part 21Raspberry pi Part 21
Raspberry pi Part 21
 
Raspberry pi Part 20
Raspberry pi Part 20Raspberry pi Part 20
Raspberry pi Part 20
 
Raspberry pi Part 19
Raspberry pi Part 19Raspberry pi Part 19
Raspberry pi Part 19
 
Raspberry pi Part 18
Raspberry pi Part 18Raspberry pi Part 18
Raspberry pi Part 18
 
Raspberry pi Part 17
Raspberry pi Part 17Raspberry pi Part 17
Raspberry pi Part 17
 
Raspberry pi Part 16
Raspberry pi Part 16Raspberry pi Part 16
Raspberry pi Part 16
 
Rasperry pi Part 15
Rasperry pi Part 15Rasperry pi Part 15
Rasperry pi Part 15
 
Rasperry pi Part 13
Rasperry pi Part 13Rasperry pi Part 13
Rasperry pi Part 13
 
Rasperry pi Part 12
Rasperry pi Part 12Rasperry pi Part 12
Rasperry pi Part 12
 
Rasperry pi Part 10
Rasperry pi Part 10Rasperry pi Part 10
Rasperry pi Part 10
 
Rasperry pi Part 9
Rasperry pi Part 9Rasperry pi Part 9
Rasperry pi Part 9
 
Rasperry pi Part 8
Rasperry pi Part 8Rasperry pi Part 8
Rasperry pi Part 8
 
Rasperry pi Part 7
Rasperry pi Part 7Rasperry pi Part 7
Rasperry pi Part 7
 
Raspberry pi Part 6
Raspberry pi Part 6Raspberry pi Part 6
Raspberry pi Part 6
 
Raspberry pi Part 5
Raspberry pi Part 5Raspberry pi Part 5
Raspberry pi Part 5
 

Último

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 

Último (20)

Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 

WIFI MODEM Part-22

  • 3. www.techvilla.org.in Wifi modem esp8266 • The ESP8266 is a low cost Serial-to-WiFi module that interfaces nicely to any microcontroller. • The ESP8266 has a fullTCP/UDP stack support. • It can also be easily configured as a web server.The module accepts commands via a simple serial interface. It then responds back with the operation's outcome (assuming everything is running correctly). • Once the device is connected and is set to accept connections, it will send unsolicited messages whenever a new connection or a new request is issued.
  • 4. www.techvilla.org.in Testing the module via FTDI (or a USB-to-Serial cable) • the module is not designed for more than 3.6V, so a 3.3V power supply should be used - both for power and logic. • The typical operating voltage is 3.3V (acceptable range is 1.7V to 3.6V). As the module can draw up to 200 to 300mA peak power, make sure the power supply can deliver at least 300mA. For example, the 3.3V line from a USB-serial cable would be barely sufficient, in that case it’s better to use a LDO to derive 3.3V from the 5V line. • When using the module with a 5V microcontroller, such as a standard Arduino, make sure to use a level shifter on the URXD pin — a simple resistor-zener level shifter is sufficient. Again, this is to prevent over-voltage.
  • 6. www.techvilla.org.in BASIC COMMANDS • AT+RST ----restart the module • AT+CWMODE—wifi mode • AT+CIPSTATUS—get the connection status • AT+CIPSEND -- send data • AT+CIPCLOSE---close theTCP/UDP connection
  • 7. www.techvilla.org.in TCP/IP protocol family • IP : Internet Protocol • UDP : User Datagram Protocol • RTP, traceroute • TCP : Transmission Control Protocol • HTTP, FTP, ssh
  • 8. www.techvilla.org.in What is an internet? • A set of interconnected networks • The Internet is the most famous example • Networks can be completely different • Ethernet, ATM, modem, … • (TCP/)IP is what links them
  • 9. www.techvilla.org.in What is an internet? (cont) • Routers (nodes) are devices on multiple networks that pass traffic between them • Individual networks pass traffic from one router or endpoint to another • TCP/IP hides the details as much as possible
  • 10. www.techvilla.org.in ISO/OSI Network Model • Seven network “layers” • Layer 1 : Physical – cables • Layer 2 : Data Link – ethernet • Layer 3 : Network – IP • Layer 4 : Transport – TCP/UDP • Layer 5 : Session • Layer 6 : Presentation • Layer 7 : Application
  • 11. www.techvilla.org.in TCP/IP Network Model • Different view – 4 layers • Layer 1 : Link (we did not look at details) • Layer 2 : Network • Layer 3 : Transport • Layer 4 : Application
  • 12. www.techvilla.org.in OSI and Protocol Stack OSI: Open Systems Interconnect OSI Model TCP/IP Hierarchy Protocols 7th Application Layer 6th Presentation Layer 5th Session Layer 4th Transport Layer 3rd Network Layer 2nd Link Layer 1st Physical Layer Application Layer Transport Layer Network Layer Link Layer Link Layer : includes device driver and network interface card Network Layer : handles the movement of packets, i.e. Routing Transport Layer : provides a reliable flow of data between two hosts Application Layer : handles the details of the particular application
  • 13. www.techvilla.org.in Packet Encapsulation  The data is sent down the protocol stack  Each layer adds to the data by prepending headers 22Bytes 20Bytes 20Bytes 4Bytes 64 to 1500 Bytes
  • 14. www.techvilla.org.in IP • Responsible for end to end transmission • Sends data in individual packets • Maximum size of packet is determined by the networks • Fragmented if too large • Unreliable • Packets might be lost, corrupted, duplicated, delivered out of order
  • 15. www.techvilla.org.in IP addresses • 4 bytes • e.g. 163.1.125.98 • Each device normally gets one (or more) • In theory there are about 4 billion available
  • 16. www.techvilla.org.in Routing • How does a device know where to send a packet? • All devices need to know what IP addresses are on directly attached networks • If the destination is on a local network, send it directly there
  • 17. www.techvilla.org.in Routing (cont) • If the destination address isn’t local • Most non-router devices just send everything to a single local router • Routers need to know which network corresponds to each possible IP address
  • 18. www.techvilla.org.in Allocation of addresses • Controlled centrally by ICANN • Fairly strict rules on further delegation to avoid wastage • Have to demonstrate actual need for them • Organizations that got in early have bigger allocations than they really need
  • 19. www.techvilla.org.in IP packets • Source and destination addresses • Protocol number • 1 = ICMP, 6 = TCP, 17 = UDP • Various options • e.g. to control fragmentation • Time to live (TTL) • Prevent routing loops
  • 20. IP DatagramVers Len TOS Total Length Identification Flags Fragment Offset TTL Protocol Header Checksum Source Internet Address Destination Internet Address Options... Padding Data... 0 4 8 16 19 24 31 Field Purpose Vers IP version number Len Length of IP header (4 octet units) TOS Type of Service T. Length Length of entire datagram (octets) Ident. IP datagram ID (for frag/reassembly) Flags Don’t/More fragments Frag Off Fragment Offset Field Purpose TTL Time To Live - Max # of hops Protocol Higher level protocol (1=ICMP, 6=TCP, 17=UDP) Checksum Checksum for the IP header Source IA Originator’s Internet Address Dest. IA Final Destination Internet Address Options Source route, time stamp, etc. Data... Higher level protocol data We only looked at the IP addresses, TTL and protocol #
  • 21. www.techvilla.org.in IP Routing • RoutingTable Destination IP address IP address of a next-hop router Flags Network interface specification Application Transport Network Link Application Transport Network Link Network Link Source Destination Router
  • 22. www.techvilla.org.in UDP • Thin layer on top of IP • Adds packet length + checksum • Guard against corrupted packets • Also source and destination ports • Ports are used to associate a packet with a specific application at each end • Still unreliable: • Duplication, loss, out-of-orderness possible
  • 23. UDP datagram Destination PortSource Port Application data 0 16 31 ChecksumLength Field Purpose Source Port 16-bit port number identifying originating application Destination Port 16-bit port number identifying destination application Length Length of UDP datagram (UDP header + data) Checksum Checksum of IP pseudo header, UDP header, and data
  • 24. www.techvilla.org.in Typical applications of UDP • Where packet loss etc is better handled by the application than the network stack • Where the overhead of setting up a connection isn’t wanted • VOIP • NFS – Network File System • Most games
  • 25. www.techvilla.org.in TCP • Reliable, full-duplex, connection-oriented, stream delivery • Interface presented to the application doesn’t require data in individual packets • Data is guaranteed to arrive, and in the correct order without duplications • Or the connection will be dropped • Imposes significant overheads
  • 26. www.techvilla.org.in Applications of TCP • Most things! • HTTP, FTP, … • Saves the application a lot of work, so used unless there’s a good reason not to
  • 27. www.techvilla.org.in TCP implementation • Connections are established using a three-way handshake • Data is divided up into packets by the operating system • Packets are numbered, and received packets are acknowledged • Connections are explicitly closed • (or may abnormally terminate)
  • 28. www.techvilla.org.in TCP Packets • Source + destination ports • Sequence number (used to order packets) • Acknowledgement number (used to verify packets are received)
  • 29. TCP SegmentDestination Port Acknowledgment Number Options... Padding Data... 0 4 10 16 19 24 31 Source Port WindowLen Sequence Number Reserved Flags Urgent PointerChecksum Field Purpose Source Port Identifies originating application Destination Port Identifies destination application Sequence Number Sequence number of first octet in the segment Acknowledgment # Sequence number of the next expected octet (if ACK flag set) Len Length of TCP header in 4 octet units Flags TCP flags: SYN, FIN, RST, PSH, ACK, URG Window Number of octets from ACK that sender will accept Checksum Checksum of IP pseudo-header + TCP header + data Urgent Pointer Pointer to end of “urgent data” Options Special TCP options such as MSS and Window Scale You just need to know port numbers, seq and ack are added
  • 30. www.techvilla.org.in TCP : Data transferHostClient Send Packet 1 Start Timer Retransmit Packet1 Start Timer Packet should arrive ACK should be sent ACK would normally Arrive at this time Receive Packet 1 Send AXK 1 Time Expires Receive ACK 1 Cancel Timer Packet Lost Timer Timer