SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
Arduino Ethernet Shield
Arduino + Ethernet
Twittering plant
★Wiznet W5100 ethernet chip
★Client
★Server
★TCP
★UDP
★Four channels



Capabilities
★All looks like a serial port


★Ethernet: initialise network
★Client: connect to a port on a
server, then read() and write()
★Server: waits for a connection
on a port

The Ethernet library
★DHCP needs 3rd-party library
★No DNS
★DIY for high-level protocols
(no HTTP library, etc) - lots of
print() statements
★Library memory footprint



Ethernet limitations
Practical 1: on the network
Example file:
         ChatServer



Practical 1: on the network
byte   mac[] = { 0xDE,0xAD,0xBE,0xEF,0xFE,
0xED   };
byte   ip[] = { 10, 0, 0, 177 };
byte   gateway[] = { 10, 0, 0, 1 };
byte   subnet[] = { 255, 255, 0, 0 };

...

Ethernet.begin(mac,ip,gateway,subnet);




Configuration
Talking HTTP
$ curl -v http://www.example.com




Talking HTTP
$ curl -v http://www.example.com
* About to connect() to www.example.com port 80 (#0)
*   Trying 208.77.188.166... connected
* Connected to www.example.com (208.77.188.166) port 80 (#0)




Talking HTTP: the request
$   curl -v http://www.example.com
*   About to connect() to www.example.com port 80 (#0)
*     Trying 208.77.188.166... connected
*   Connected to www.example.com (208.77.188.166) port 80 (#0)
>   GET / HTTP/1.1
>   User-Agent: curl/7.16.3
>   Host: www.example.com
>   Accept: */*
>




Talking HTTP: the request
$   curl -v http://www.example.com
*   About to connect() to www.example.com port 80 (#0)
*     Trying 208.77.188.166... connected
*   Connected to www.example.com (208.77.188.166) port 80 (#0)
>   GET / HTTP/1.1
>   User-Agent: curl/7.16.3
>   Host: www.example.com
>   Accept: */*
>
<   HTTP/1.1 200 OK
<   Date: Sun, 16 Aug 2009 16:05:42 GMT
<   Server: Apache/2.2.3 (Red Hat)
<   Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT
<   ETag: "b80f4-1b6-80bfd280"
<   Accept-Ranges: bytes
<   Content-Length: 438
<   Connection: close
<   Content-Type: text/html; charset=UTF-8




Talking HTTP: the response
$ curl -v http://www.example.com
* About to connect() to www.example.com port 80 (#0)
*   Trying 208.77.188.166... connected
* Connected to www.example.com (208.77.188.166) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.16.3
> Host: www.example.com
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Sun, 16 Aug 2009 16:05:42 GMT
< Server: Apache/2.2.3 (Red Hat)
< Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT
< ETag: "b80f4-1b6-80bfd280"
< Accept-Ranges: bytes
< Content-Length: 438
< Connection: close
< Content-Type: text/html; charset=UTF-8
<
<HTML>
..........



Talking HTTP: the document
> GET / HTTP/1.1
> Host: www.example.com
>
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=UTF-8
<
<HTML>
..........




The most important bits
Practical 2: retrieving data
Example file:
         WebClient



Practical 2: retrieving data
★It’s just HTTP
★At least, the good ones are




Web APIs
★HTTPS
★Crypto (e.g. OAuth)
★XML parsing
★JSON parsing
★Large documents




Web API challenges
Practical 3: serving data
Example file:
         WebServer



Practical 3: serving data

Mais conteúdo relacionado

Mais procurados

DRAFT Internet and world wide web protocol ; pu t ty ; telnet ; wireshark
DRAFT Internet and world wide web protocol ; pu t ty ; telnet ; wiresharkDRAFT Internet and world wide web protocol ; pu t ty ; telnet ; wireshark
DRAFT Internet and world wide web protocol ; pu t ty ; telnet ; wireshark
meazza_15
 
Scalable Socket Server by Aryo
Scalable Socket Server by AryoScalable Socket Server by Aryo
Scalable Socket Server by Aryo
Agate Studio
 

Mais procurados (19)

DRAFT Internet and world wide web protocol ; pu t ty ; telnet ; wireshark
DRAFT Internet and world wide web protocol ; pu t ty ; telnet ; wiresharkDRAFT Internet and world wide web protocol ; pu t ty ; telnet ; wireshark
DRAFT Internet and world wide web protocol ; pu t ty ; telnet ; wireshark
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websockets
 
Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developers
 
Nmap Scripting Engine and http-enumeration
Nmap Scripting Engine and http-enumerationNmap Scripting Engine and http-enumeration
Nmap Scripting Engine and http-enumeration
 
Monitoring with Syslog and EventMachine
Monitoring with Syslog and EventMachineMonitoring with Syslog and EventMachine
Monitoring with Syslog and EventMachine
 
Nessus scan report using microsoft patchs scan policy - Tareq Hanaysha
Nessus scan report using microsoft patchs scan policy - Tareq HanayshaNessus scan report using microsoft patchs scan policy - Tareq Hanaysha
Nessus scan report using microsoft patchs scan policy - Tareq Hanaysha
 
Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...
Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...
Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...
 
Phd3
Phd3Phd3
Phd3
 
Docker-OVS
Docker-OVSDocker-OVS
Docker-OVS
 
Docker Networking
Docker NetworkingDocker Networking
Docker Networking
 
HTTPS: All you need to know
HTTPS: All you need to knowHTTPS: All you need to know
HTTPS: All you need to know
 
Vm ware fuzzing - defcon russia 20
Vm ware fuzzing  - defcon russia 20Vm ware fuzzing  - defcon russia 20
Vm ware fuzzing - defcon russia 20
 
Network programming using python
Network programming using pythonNetwork programming using python
Network programming using python
 
Dns centos
Dns centosDns centos
Dns centos
 
Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no pro...
Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no pro...Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no pro...
Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no pro...
 
Scalable Socket Server by Aryo
Scalable Socket Server by AryoScalable Socket Server by Aryo
Scalable Socket Server by Aryo
 
OSMC 2014: MQTT for monitoring (and for the lo t) | Jan-Piet Mens
OSMC 2014: MQTT for monitoring (and for the lo t) | Jan-Piet MensOSMC 2014: MQTT for monitoring (and for the lo t) | Jan-Piet Mens
OSMC 2014: MQTT for monitoring (and for the lo t) | Jan-Piet Mens
 
Ostinato FOSS.IN 2010
Ostinato FOSS.IN 2010Ostinato FOSS.IN 2010
Ostinato FOSS.IN 2010
 
tit
tittit
tit
 

Semelhante a Ethernet Shield

Application Layer and Socket Programming
Application Layer and Socket ProgrammingApplication Layer and Socket Programming
Application Layer and Socket Programming
elliando dias
 
Apache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual HostingApache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual Hosting
webhostingguy
 
16network Programming Servers
16network Programming Servers16network Programming Servers
16network Programming Servers
Adil Jafri
 
17937858 squid-server - [the-xp.blogspot.com]
17937858 squid-server - [the-xp.blogspot.com]17937858 squid-server - [the-xp.blogspot.com]
17937858 squid-server - [the-xp.blogspot.com]
Krisman Tarigan
 

Semelhante a Ethernet Shield (20)

WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
 
Application Layer and Socket Programming
Application Layer and Socket ProgrammingApplication Layer and Socket Programming
Application Layer and Socket Programming
 
03 sockets
03 sockets03 sockets
03 sockets
 
Apache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual HostingApache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual Hosting
 
Unidade3 roteiro proxy
Unidade3 roteiro proxyUnidade3 roteiro proxy
Unidade3 roteiro proxy
 
Unit 8 Java
Unit 8 JavaUnit 8 Java
Unit 8 Java
 
16network Programming Servers
16network Programming Servers16network Programming Servers
16network Programming Servers
 
Rpi python web
Rpi python webRpi python web
Rpi python web
 
T2
T2T2
T2
 
Network Prog.ppt
Network Prog.pptNetwork Prog.ppt
Network Prog.ppt
 
Net Programming.ppt
Net Programming.pptNet Programming.ppt
Net Programming.ppt
 
03_clere-HTTP2 HTTP3 the State of the Art in Our Servers.pdf
03_clere-HTTP2 HTTP3 the State of the Art in Our Servers.pdf03_clere-HTTP2 HTTP3 the State of the Art in Our Servers.pdf
03_clere-HTTP2 HTTP3 the State of the Art in Our Servers.pdf
 
Socket Programming it-slideshares.blogspot.com
Socket  Programming it-slideshares.blogspot.comSocket  Programming it-slideshares.blogspot.com
Socket Programming it-slideshares.blogspot.com
 
Sockets intro
Sockets introSockets intro
Sockets intro
 
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
 
17937858 squid-server - [the-xp.blogspot.com]
17937858 squid-server - [the-xp.blogspot.com]17937858 squid-server - [the-xp.blogspot.com]
17937858 squid-server - [the-xp.blogspot.com]
 
Pemrograman Jaringan
Pemrograman JaringanPemrograman Jaringan
Pemrograman Jaringan
 
28 networking
28  networking28  networking
28 networking
 
HTTP2 and gRPC
HTTP2 and gRPCHTTP2 and gRPC
HTTP2 and gRPC
 
Http capturing
Http capturingHttp capturing
Http capturing
 

Mais de Tinker London (9)

Homesense @ La Cantine
Homesense @ La CantineHomesense @ La Cantine
Homesense @ La Cantine
 
Arduino Power
Arduino PowerArduino Power
Arduino Power
 
Programming for Artists and Designers: Week 3
Programming for Artists and Designers: Week 3Programming for Artists and Designers: Week 3
Programming for Artists and Designers: Week 3
 
XBee and RFID
XBee and RFIDXBee and RFID
XBee and RFID
 
Programming for Artists and Designers: Week 2
Programming for Artists and Designers: Week 2Programming for Artists and Designers: Week 2
Programming for Artists and Designers: Week 2
 
Programming for Artists and Designers: Week 1
Programming for Artists and Designers: Week 1Programming for Artists and Designers: Week 1
Programming for Artists and Designers: Week 1
 
Playful
PlayfulPlayful
Playful
 
Mobile Games and Hardware Hacking
Mobile Games and Hardware HackingMobile Games and Hardware Hacking
Mobile Games and Hardware Hacking
 
Arduino and Open Hardware
Arduino and Open HardwareArduino and Open Hardware
Arduino and Open Hardware
 

Ethernet Shield

  • 4. ★Wiznet W5100 ethernet chip ★Client ★Server ★TCP ★UDP ★Four channels Capabilities
  • 5. ★All looks like a serial port ★Ethernet: initialise network ★Client: connect to a port on a server, then read() and write() ★Server: waits for a connection on a port The Ethernet library
  • 6. ★DHCP needs 3rd-party library ★No DNS ★DIY for high-level protocols (no HTTP library, etc) - lots of print() statements ★Library memory footprint Ethernet limitations
  • 7. Practical 1: on the network
  • 8. Example file: ChatServer Practical 1: on the network
  • 9. byte mac[] = { 0xDE,0xAD,0xBE,0xEF,0xFE, 0xED }; byte ip[] = { 10, 0, 0, 177 }; byte gateway[] = { 10, 0, 0, 1 }; byte subnet[] = { 255, 255, 0, 0 }; ... Ethernet.begin(mac,ip,gateway,subnet); Configuration
  • 11. $ curl -v http://www.example.com Talking HTTP
  • 12. $ curl -v http://www.example.com * About to connect() to www.example.com port 80 (#0) * Trying 208.77.188.166... connected * Connected to www.example.com (208.77.188.166) port 80 (#0) Talking HTTP: the request
  • 13. $ curl -v http://www.example.com * About to connect() to www.example.com port 80 (#0) * Trying 208.77.188.166... connected * Connected to www.example.com (208.77.188.166) port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.16.3 > Host: www.example.com > Accept: */* > Talking HTTP: the request
  • 14. $ curl -v http://www.example.com * About to connect() to www.example.com port 80 (#0) * Trying 208.77.188.166... connected * Connected to www.example.com (208.77.188.166) port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.16.3 > Host: www.example.com > Accept: */* > < HTTP/1.1 200 OK < Date: Sun, 16 Aug 2009 16:05:42 GMT < Server: Apache/2.2.3 (Red Hat) < Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT < ETag: "b80f4-1b6-80bfd280" < Accept-Ranges: bytes < Content-Length: 438 < Connection: close < Content-Type: text/html; charset=UTF-8 Talking HTTP: the response
  • 15. $ curl -v http://www.example.com * About to connect() to www.example.com port 80 (#0) * Trying 208.77.188.166... connected * Connected to www.example.com (208.77.188.166) port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.16.3 > Host: www.example.com > Accept: */* > < HTTP/1.1 200 OK < Date: Sun, 16 Aug 2009 16:05:42 GMT < Server: Apache/2.2.3 (Red Hat) < Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT < ETag: "b80f4-1b6-80bfd280" < Accept-Ranges: bytes < Content-Length: 438 < Connection: close < Content-Type: text/html; charset=UTF-8 < <HTML> .......... Talking HTTP: the document
  • 16. > GET / HTTP/1.1 > Host: www.example.com > < HTTP/1.1 200 OK < Content-Type: text/html; charset=UTF-8 < <HTML> .......... The most important bits
  • 18. Example file: WebClient Practical 2: retrieving data
  • 19. ★It’s just HTTP ★At least, the good ones are Web APIs
  • 20. ★HTTPS ★Crypto (e.g. OAuth) ★XML parsing ★JSON parsing ★Large documents Web API challenges
  • 22. Example file: WebServer Practical 3: serving data