• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Apple Bonjour: Let's Talk!
 

Apple Bonjour: Let's Talk!

on

  • 1,123 views

"Bonjour" è ben più di un formale saluto in francese. :) Molti programmatori lo usano durante il proprio lavoro ma pochissimi lo conoscono veramente. Non stiamo ovviamente parlando della lingua ...

"Bonjour" è ben più di un formale saluto in francese. :) Molti programmatori lo usano durante il proprio lavoro ma pochissimi lo conoscono veramente. Non stiamo ovviamente parlando della lingua francese, ma di "Bonjour", il protocollo di comunicazione che da anni viene utilizzato sui sistemi operativi iOS, OSX assieme ad altre piattaforme, tra cui Android. Durante questo talk esploreremo i suoi vantaggi principali, per poi imparare a utilizzarlo attraverso un caso reale: verrà illustrato lo sviluppo di un'applicazione nativa per iPad che metta in comunicazione diversi device all'interno della medesima rete, creando una chat ed un servizio di ScreenCast.

Statistics

Views

Total Views
1,123
Views on SlideShare
1,056
Embed Views
67

Actions

Likes
3
Downloads
12
Comments
0

2 Embeds 67

http://www.whymca.org 66
https://abs.twimg.com 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Apple Bonjour: Let's Talk! Apple Bonjour: Let's Talk! Presentation Transcript

    • APPLE BONJOUR, LET’S TALK! Nicholas Valbusa - @squallstar Intesys Web AgencyThursday, May 24, 12
    • Thursday, May 24, 12
    • Few words about meThursday, May 24, 12
    • Few words about me Nicholas Valbusa @squallstarThursday, May 24, 12
    • Few words about me Nicholas Valbusa @squallstar Web Developer since 2004Thursday, May 24, 12
    • Few words about me Nicholas Valbusa @squallstar Web Developer since 2004 Mobile Developer since 2010Thursday, May 24, 12
    • Few words about me Nicholas Valbusa @squallstar Web Developer since 2004 Mobile Developer since 2010 WHYMCA 2011: Webkit meets Native developmentThursday, May 24, 12
    • Thursday, May 24, 12
    • Intesys è una Web Agency Innovativa nata nel 1995 a VeronaThursday, May 24, 12
    • Intesys è una Web Agency Innovativa nata nel 1995 a Verona Un team di 90 specialisti divisi in 4 areeThursday, May 24, 12
    • Intesys è una Web Agency Innovativa nata nel 1995 a Verona Un team di 90 specialisti divisi in 4 areeThursday, May 24, 12
    • We’ll talk aboutThursday, May 24, 12
    • We’ll talk aboutThursday, May 24, 12
    • We’ll talk aboutThursday, May 24, 12
    • We’ll talk about • TCP/IPThursday, May 24, 12
    • We’ll talk about • TCP/IP • Apple Bonjour, uPNPThursday, May 24, 12
    • We’ll talk about • TCP/IP • Apple Bonjour, uPNP • Socket, Stream, BuffersThursday, May 24, 12
    • We’ll talk about • TCP/IP • Apple Bonjour, uPNP • Socket, Stream, Buffers • Create and publish a serverThursday, May 24, 12
    • We’ll talk about • TCP/IP • Apple Bonjour, uPNP • Socket, Stream, Buffers • Create and publish a server • Join a serverThursday, May 24, 12
    • We’ll talk about • TCP/IP • Apple Bonjour, uPNP • Socket, Stream, Buffers • Create and publish a server • Join a server • Network messagesThursday, May 24, 12
    • We’ll talk about • TCP/IP • Apple Bonjour, uPNP • Socket, Stream, Buffers • Create and publish a server • Join a server • Network messages • Other...Thursday, May 24, 12
    • We’ll seeThursday, May 24, 12
    • We’ll see • A screencast native applicationThursday, May 24, 12
    • We’ll see • A screencast native application • Something like chatsThursday, May 24, 12
    • We’ll see • A screencast native application • Something like chats • Where server can send images and other thingsThursday, May 24, 12
    • We’ll see • A screencast native application • Something like chats • Where server can send images and other things Follow the talk from your iPad using the same app that we’re going to make iCastThursday, May 24, 12
    • iCastThursday, May 24, 12
    • iCastThursday, May 24, 12
    • iCastThursday, May 24, 12
    • Thursday, May 24, 12
    • “Once upon a time”Thursday, May 24, 12
    • “Once upon a time” Apple TalkThursday, May 24, 12
    • “Once upon a time” Apple Talk • Protocollo usato nelle reti MacintoshThursday, May 24, 12
    • “Once upon a time” Apple Talk • Protocollo usato nelle reti Macintosh • Condivisione di file e stampantiThursday, May 24, 12
    • “Once upon a time” Apple Talk • Protocollo usato nelle reti Macintosh • Condivisione di file e stampanti • Uno dei primi sistemi plug-n-playThursday, May 24, 12
    • Thursday, May 24, 12
    • “things changes”Thursday, May 24, 12
    • “things changes” TCP/IPThursday, May 24, 12
    • “things changes” TCP/IP • Negli anni novanta, con la diffusione del TCP/IP Apple dismesse AppleTalkThursday, May 24, 12
    • “things changes” TCP/IP • Negli anni novanta, con la diffusione del TCP/IP Apple dismesse AppleTalk • Finalmente i Mac potevano connettersi con altri sistemi operativiThursday, May 24, 12
    • Thursday, May 24, 12
    • Zeroconf DHCP DNSThursday, May 24, 12
    • Zeroconf DHCP DNS “A set of techniques that automatically creates a usable IP network without manual operator intervention”Thursday, May 24, 12
    • Thursday, May 24, 12
    • BonjourThursday, May 24, 12
    • Bonjour L’implementazione Apple di “Zero configuration network”Thursday, May 24, 12
    • Bonjour L’implementazione Apple di “Zero configuration network” “It just works”Thursday, May 24, 12
    • Bonjour L’implementazione Apple di “Zero configuration network” “It just works” • mDNS + DNS Service discoveryThursday, May 24, 12
    • Bonjour L’implementazione Apple di “Zero configuration network” “It just works” • mDNS + DNS Service discovery • Address assignmentThursday, May 24, 12
    • Bonjour L’implementazione Apple di “Zero configuration network” “It just works” • mDNS + DNS Service discovery • Address assignment • Name resolutionThursday, May 24, 12
    • BonjourThursday, May 24, 12
    • Bonjour • Built-in con OSX e iOS.Thursday, May 24, 12
    • Bonjour • Built-in con OSX e iOS. • Installabile su WindowsThursday, May 24, 12
    • Bonjour • Built-in con OSX e iOS. • Installabile su Windows • Incluso in Safari e iTunes.Thursday, May 24, 12
    • Bonjour • Built-in con OSX e iOS. • Installabile su Windows • Incluso in Safari e iTunes. • Incluso nella Creative Suite 3 di AdobeThursday, May 24, 12
    • Thursday, May 24, 12
    • Who uses itThursday, May 24, 12
    • Who uses it • iTunes finds shared musicThursday, May 24, 12
    • Who uses it • iTunes finds shared music • iPhotos finds shared photosThursday, May 24, 12
    • Who uses it • iTunes finds shared music • iPhotos finds shared photos • iChat, Skype, AdiumThursday, May 24, 12
    • Who uses it • iTunes finds shared music • iPhotos finds shared photos • iChat, Skype, Adium • Adobe Creative Suite 3+Thursday, May 24, 12
    • Who uses it • iTunes finds shared music • iPhotos finds shared photos • iChat, Skype, Adium • Adobe Creative Suite 3+ • Things, OmnifocusThursday, May 24, 12
    • Who uses it • iTunes finds shared music • iPhotos finds shared photos • iChat, Skype, Adium • Adobe Creative Suite 3+ • Things, Omnifocus • Cyberduck, Coda, SubEthaEditThursday, May 24, 12
    • Who uses it • iTunes finds shared music • iPhotos finds shared photos • iChat, Skype, Adium • Adobe Creative Suite 3+ • Things, Omnifocus • Cyberduck, Coda, SubEthaEdit • PostgreSQLThursday, May 24, 12
    • Who uses it • iTunes finds shared music • iPhotos finds shared photos • iChat, Skype, Adium • Adobe Creative Suite 3+ • Things, Omnifocus • Cyberduck, Coda, SubEthaEdit • PostgreSQL • All uPNP-enabled devicesThursday, May 24, 12
    • Thursday, May 24, 12
    • Who can also use itThursday, May 24, 12
    • Who can also use itThursday, May 24, 12
    • Who can also use it Using “jmDNS”, a Java implementation of multi-cast DNS for LAN service registration/discovery.Thursday, May 24, 12
    • Thursday, May 24, 12
    • uPNP Universal plug-n-playThursday, May 24, 12
    • uPNP Universal plug-n-play • It’s just another implementation of ZeroconfThursday, May 24, 12
    • uPNP Universal plug-n-play • It’s just another implementation of Zeroconf • Media servers, Consoles, DLNA servers...Thursday, May 24, 12
    • uPNP Universal plug-n-play • It’s just another implementation of Zeroconf • Media servers, Consoles, DLNA servers... • No authenticationThursday, May 24, 12
    • uPNP Universal plug-n-play • It’s just another implementation of Zeroconf • Media servers, Consoles, DLNA servers... • No authentication • No mDNSThursday, May 24, 12
    • Thursday, May 24, 12
    • Bonjour: Service PublicationThursday, May 24, 12
    • Bonjour: Service PublicationThursday, May 24, 12
    • Thursday, May 24, 12
    • Bonjour: Service PublicationThursday, May 24, 12
    • Bonjour: Service PublicationThursday, May 24, 12
    • Thursday, May 24, 12
    • Bonjour: Query for servicesThursday, May 24, 12
    • Bonjour: Query for servicesThursday, May 24, 12
    • Thursday, May 24, 12
    • Bonjour: ConnectThursday, May 24, 12
    • Bonjour: ConnectThursday, May 24, 12
    • Thursday, May 24, 12
    • Sockets vs StreamsThursday, May 24, 12
    • Sockets vs Streams • Socket: unique communication endpoint on the networkThursday, May 24, 12
    • Sockets vs Streams • Socket: unique communication endpoint on the network • Stream: one-way channel through which data is transmitted seriallyThursday, May 24, 12
    • Thursday, May 24, 12
    • We will useThursday, May 24, 12
    • We will use • Stream sockets that are paired up to allow our app to send data over network using TCP/IPThursday, May 24, 12
    • We will use • Stream sockets that are paired up to allow our app to send data over network using TCP/IP • Asynchronous, non-blocking operationsThursday, May 24, 12
    • Thursday, May 24, 12
    • 3 Networking ClassesThursday, May 24, 12
    • 3 Networking Classes Server class:Thursday, May 24, 12
    • 3 Networking Classes Server class: • Creates a serverThursday, May 24, 12
    • 3 Networking Classes Server class: • Creates a server • Announces the server via BonjourThursday, May 24, 12
    • 3 Networking Classes Server class: • Creates a server • Announces the server via Bonjour Connection class:Thursday, May 24, 12
    • 3 Networking Classes Server class: • Creates a server • Announces the server via Bonjour Connection class: • Resolves Bonjour ServicesThursday, May 24, 12
    • 3 Networking Classes Server class: • Creates a server • Announces the server via Bonjour Connection class: • Resolves Bonjour Services • Establishes connections to other serversThursday, May 24, 12
    • 3 Networking Classes Server class: • Creates a server • Announces the server via Bonjour Connection class: • Resolves Bonjour Services • Establishes connections to other servers • Exchanges data via socket streamsThursday, May 24, 12
    • 3 Networking Classes Server class: • Creates a server • Announces the server via Bonjour Connection class: • Resolves Bonjour Services • Establishes connections to other servers • Exchanges data via socket streams Server Browser class:Thursday, May 24, 12
    • 3 Networking Classes Server class: • Creates a server • Announces the server via Bonjour Connection class: • Resolves Bonjour Services • Establishes connections to other servers • Exchanges data via socket streams Server Browser class: • Browses for other servers via BonjourThursday, May 24, 12
    • Thursday, May 24, 12
    • Application layersThursday, May 24, 12
    • Application layersThursday, May 24, 12
    • Application layersThursday, May 24, 12
    • Application layersThursday, May 24, 12
    • Thursday, May 24, 12
    • Down the Connection classThursday, May 24, 12
    • Down the Connection class 2 stream sockets (one for writing, one for reading) 2 data buffers (one for each socket stream)Thursday, May 24, 12
    • Thursday, May 24, 12
    • Network messagesThursday, May 24, 12
    • Network messages How do we separate network messages from one another?Thursday, May 24, 12
    • Network messages How do we separate network messages from one another? 3 different ways:Thursday, May 24, 12
    • Network messages How do we separate network messages from one another? 3 different ways: 1) Make all messages have the same lengthThursday, May 24, 12
    • Network messages How do we separate network messages from one another? 3 different ways: 1) Make all messages have the same length 2) Append a marker to each messageThursday, May 24, 12
    • Network messages How do we separate network messages from one another? 3 different ways: 1) Make all messages have the same length 2) Append a marker to each message 3) Send some kind of header with some info about how long the message isThursday, May 24, 12
    • Network messages How do we separate network messages from one another? 3 different ways: 1) Make all messages have the same length 2) Append a marker to each message 3) Send some kind of header with some info about how long the message isThursday, May 24, 12
    • Thursday, May 24, 12
    • 3) Send some kind of header...Thursday, May 24, 12
    • 3) Send some kind of header... Writing messagesThursday, May 24, 12
    • 3) Send some kind of header... Writing messages • Convert an object into a byte array and measure its lengthThursday, May 24, 12
    • 3) Send some kind of header... Writing messages • Convert an object into a byte array and measure its length • Write the integer (4 bytes) that represents the length of our byte array to the streamThursday, May 24, 12
    • 3) Send some kind of header... Writing messages • Convert an object into a byte array and measure its length • Write the integer (4 bytes) that represents the length of our byte array to the stream • Write the actual byte array to the streamThursday, May 24, 12
    • Reading messagesThursday, May 24, 12
    • Reading messages • Read first 4 bytes and interpret those as an integer called “x”Thursday, May 24, 12
    • Reading messages • Read first 4 bytes and interpret those as an integer called “x” • Read “x” number of bytes. (stop when enough data has been received)Thursday, May 24, 12
    • Reading messages • Read first 4 bytes and interpret those as an integer called “x” • Read “x” number of bytes. (stop when enough data has been received) • Turn received sequence of bytes back into an object.Thursday, May 24, 12
    • Thursday, May 24, 12
    • It’s time!Thursday, May 24, 12
    • Thursday, May 24, 12
    • FrameworksThursday, May 24, 12
    • Frameworks • Low level: BSD socket libThursday, May 24, 12
    • Frameworks • Low level: BSD socket libThursday, May 24, 12
    • Frameworks • Low level: BSD socket lib • High level: CFNetworkThursday, May 24, 12
    • Frameworks • Low level: BSD socket lib • High level: CFNetwork • Bonjour iOS API: NSNetServices, CFNetServicesThursday, May 24, 12
    • Thursday, May 24, 12
    • Creating a serverThursday, May 24, 12
    • Creating a server We first create a stream socket that will listen for connectionsThursday, May 24, 12
    • Creating a server We first create a stream socket that will listen for connections CFSocketRef listeningSocket;Thursday, May 24, 12
    • Creating a server We first create a stream socket that will listen for connections CFSocketRef listeningSocket; using port number 0Thursday, May 24, 12
    • Creating a server We first create a stream socket that will listen for connections CFSocketRef listeningSocket; using port number 0 zero???? O_oThursday, May 24, 12
    • Thursday, May 24, 12
    • Let’s publish the serviceThursday, May 24, 12
    • Let’s publish the serviceThursday, May 24, 12
    • Thursday, May 24, 12
    • Services/Servers BrowserThursday, May 24, 12
    • Services/Servers BrowserThursday, May 24, 12
    • Thursday, May 24, 12
    • Found!Thursday, May 24, 12
    • Found!Thursday, May 24, 12
    • Thursday, May 24, 12
    • Displaying servers listThursday, May 24, 12
    • Displaying servers listThursday, May 24, 12
    • Thursday, May 24, 12
    • Please let me joinThursday, May 24, 12
    • Please let me joinThursday, May 24, 12
    • Please let me joinThursday, May 24, 12
    • Please let me joinThursday, May 24, 12
    • Please let me joinThursday, May 24, 12
    • Thursday, May 24, 12
    • The server receives the “request”Thursday, May 24, 12
    • The server receives the “request”Thursday, May 24, 12
    • Thursday, May 24, 12
    • The server welcomes youThursday, May 24, 12
    • The server welcomes youThursday, May 24, 12
    • The server welcomes youThursday, May 24, 12
    • Thursday, May 24, 12
    • The client receives the streamThursday, May 24, 12
    • The client receives the streamThursday, May 24, 12
    • Thursday, May 24, 12
    • RecapThursday, May 24, 12
    • Recap • Apple Talk, TCP/IPThursday, May 24, 12
    • Recap • Apple Talk, TCP/IP • Bonjour flow cycle, uPNPThursday, May 24, 12
    • Recap • Apple Talk, TCP/IP • Bonjour flow cycle, uPNP • Application layers, Socket, Stream, BuffersThursday, May 24, 12
    • Recap • Apple Talk, TCP/IP • Bonjour flow cycle, uPNP • Application layers, Socket, Stream, Buffers • Write/Read Network messagesThursday, May 24, 12
    • Recap • Apple Talk, TCP/IP • Bonjour flow cycle, uPNP • Application layers, Socket, Stream, Buffers • Write/Read Network messages • Create and publish a serverThursday, May 24, 12
    • Recap • Apple Talk, TCP/IP • Bonjour flow cycle, uPNP • Application layers, Socket, Stream, Buffers • Write/Read Network messages • Create and publish a server • Join a serverThursday, May 24, 12
    • Recap • Apple Talk, TCP/IP • Bonjour flow cycle, uPNP • Application layers, Socket, Stream, Buffers • Write/Read Network messages • Create and publish a server • Join a server • Interaction between the client and the serverThursday, May 24, 12
    • Recap • Apple Talk, TCP/IP • Bonjour flow cycle, uPNP • Application layers, Socket, Stream, Buffers • Write/Read Network messages • Create and publish a server • Join a server • Interaction between the client and the server • One more thing: server broadcasts messages to connected clientsThursday, May 24, 12
    • Thursday, May 24, 12
    • Thank you. Any questions? Nicholas Valbusa @squallstar Intesys - @Intesys_IT - www.intesys.itThursday, May 24, 12