Apple Bonjour: Let's Talk!

Download Apple Bonjour: Let's Talk!

Post on 08-May-2015

965 views

Category:

Technology

0 download

Embed Size (px)

DESCRIPTION

"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.

TRANSCRIPT

<ul><li>1.APPLE BONJOUR,LETS TALK! Nicholas Valbusa - @squallstar Intesys Web AgencyThursday, May 24, 12</li></ul><p>2. Thursday, May 24, 12 3. Few words about meThursday, May 24, 12 4. Few words about me Nicholas Valbusa @squallstarThursday, May 24, 12 5. Few words about me Nicholas Valbusa @squallstar Web Developer since 2004Thursday, May 24, 12 6. Few words about me Nicholas Valbusa @squallstar Web Developer since 2004 Mobile Developer since 2010Thursday, May 24, 12 7. Few words about me Nicholas Valbusa @squallstar Web Developer since 2004 Mobile Developer since 2010 WHYMCA 2011: Webkit meets Native developmentThursday, May 24, 12 8. Thursday, May 24, 12 9. Intesys una Web Agency Innovativanata nel 1995 a VeronaThursday, May 24, 12 10. Intesys una Web Agency Innovativa nata nel 1995 a Verona Un team di 90 specialisti divisi in 4 areeThursday, May 24, 12 11. Intesys una Web Agency Innovativa nata nel 1995 a Verona Un team di 90 specialisti divisi in 4 areeThursday, May 24, 12 12. Well talk aboutThursday, May 24, 12 13. Well talk aboutThursday, May 24, 12 14. Well talk aboutThursday, May 24, 12 15. Well talk about TCP/IPThursday, May 24, 12 16. Well talk about TCP/IP Apple Bonjour, uPNPThursday, May 24, 12 17. Well talk about TCP/IP Apple Bonjour, uPNP Socket, Stream, BuffersThursday, May 24, 12 18. Well talk about TCP/IP Apple Bonjour, uPNP Socket, Stream, Buffers Create and publish a serverThursday, May 24, 12 19. Well talk about TCP/IP Apple Bonjour, uPNP Socket, Stream, Buffers Create and publish a server Join a serverThursday, May 24, 12 20. Well talk about TCP/IP Apple Bonjour, uPNP Socket, Stream, Buffers Create and publish a server Join a server Network messagesThursday, May 24, 12 21. Well 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 22. Well seeThursday, May 24, 12 23. Well see A screencast native applicationThursday, May 24, 12 24. Well see A screencast native application Something like chatsThursday, May 24, 12 25. Well see A screencast native application Something like chats Where server can send images and other thingsThursday, May 24, 12 26. Well see A screencast native application Something like chats Where server can send images and other thingsFollow the talk from your iPad using the same appthat were going to make iCastThursday, May 24, 12 27. iCastThursday, May 24, 12 28. iCastThursday, May 24, 12 29. iCastThursday, May 24, 12 30. Thursday, May 24, 12 31. Once upon a timeThursday, May 24, 12 32. Once upon a timeApple TalkThursday, May 24, 12 33. Once upon a timeApple Talk Protocollo usato nelle reti MacintoshThursday, May 24, 12 34. Once upon a timeApple Talk Protocollo usato nelle reti Macintosh Condivisione di file e stampantiThursday, May 24, 12 35. Once upon a timeApple Talk Protocollo usato nelle reti Macintosh Condivisione di file e stampanti Uno dei primi sistemi plug-n-playThursday, May 24, 12 36. Thursday, May 24, 12 37. things changesThursday, May 24, 12 38. things changes TCP/IPThursday, May 24, 12 39. things changes TCP/IP Negli anni novanta, con la diffusione del TCP/IP Apple dismesse AppleTalkThursday, May 24, 12 40. 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 41. Thursday, May 24, 12 42. ZeroconfDHCP DNSThursday, May 24, 12 43. ZeroconfDHCP DNSA set of techniques that automaticallycreates a usable IP network without manualoperator interventionThursday, May 24, 12 44. Thursday, May 24, 12 45. BonjourThursday, May 24, 12 46. Bonjour Limplementazione Apple di Zero configuration networkThursday, May 24, 12 47. Bonjour Limplementazione Apple di Zero configuration network It just worksThursday, May 24, 12 48. Bonjour Limplementazione Apple di Zero configuration network It just works mDNS + DNS Service discoveryThursday, May 24, 12 49. Bonjour Limplementazione Apple di Zero configuration network It just works mDNS + DNS Service discovery Address assignmentThursday, May 24, 12 50. Bonjour Limplementazione Apple di Zero configuration network It just works mDNS + DNS Service discovery Address assignment Name resolutionThursday, May 24, 12 51. BonjourThursday, May 24, 12 52. Bonjour Built-in con OSX e iOS.Thursday, May 24, 12 53. Bonjour Built-in con OSX e iOS. Installabile su WindowsThursday, May 24, 12 54. Bonjour Built-in con OSX e iOS. Installabile su Windows Incluso in Safari e iTunes.Thursday, May 24, 12 55. 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 56. Thursday, May 24, 12 57. Who uses itThursday, May 24, 12 58. Who uses it iTunes finds shared musicThursday, May 24, 12 59. Who uses it iTunes finds shared music iPhotos finds shared photosThursday, May 24, 12 60. Who uses it iTunes finds shared music iPhotos finds shared photos iChat, Skype, AdiumThursday, May 24, 12 61. Who uses it iTunes finds shared music iPhotos finds shared photos iChat, Skype, Adium Adobe Creative Suite 3+Thursday, May 24, 12 62. Who uses it iTunes finds shared music iPhotos finds shared photos iChat, Skype, Adium Adobe Creative Suite 3+ Things, OmnifocusThursday, May 24, 12 63. 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 64. 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 65. 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 66. Thursday, May 24, 12 67. Who can also use itThursday, May 24, 12 68. Who can also use itThursday, May 24, 12 69. Who can also use it Using jmDNS, a Java implementation of multi-cast DNS for LAN service registration/discovery.Thursday, May 24, 12 70. Thursday, May 24, 12 71. uPNP Universal plug-n-playThursday, May 24, 12 72. uPNPUniversal plug-n-play Its just another implementation of ZeroconfThursday, May 24, 12 73. uPNPUniversal plug-n-play Its just another implementation of Zeroconf Media servers, Consoles, DLNA servers...Thursday, May 24, 12 74. uPNPUniversal plug-n-play Its just another implementation of Zeroconf Media servers, Consoles, DLNA servers... No authenticationThursday, May 24, 12 75. uPNPUniversal plug-n-play Its just another implementation of Zeroconf Media servers, Consoles, DLNA servers... No authentication No mDNSThursday, May 24, 12 76. Thursday, May 24, 12 77. Bonjour: Service PublicationThursday, May 24, 12 78. Bonjour: Service PublicationThursday, May 24, 12 79. Thursday, May 24, 12 80. Bonjour: Service PublicationThursday, May 24, 12 81. Bonjour: Service PublicationThursday, May 24, 12 82. Thursday, May 24, 12 83. Bonjour: Query for servicesThursday, May 24, 12 84. Bonjour: Query for servicesThursday, May 24, 12 85. Thursday, May 24, 12 86. Bonjour: ConnectThursday, May 24, 12 87. Bonjour: ConnectThursday, May 24, 12 88. Thursday, May 24, 12 89. Sockets vs StreamsThursday, May 24, 12 90. Sockets vs Streams Socket: unique communication endpoint on the networkThursday, May 24, 12 91. Sockets vs Streams Socket: unique communication endpoint on the network Stream: one-way channel through which data is transmitted seriallyThursday, May 24, 12 92. Thursday, May 24, 12 93. We will useThursday, May 24, 12 94. We will use Stream sockets that are paired up to allow our app to send data over network using TCP/IPThursday, May 24, 12 95. 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 96. Thursday, May 24, 12 97. 3 Networking ClassesThursday, May 24, 12 98. 3 Networking Classes Server class:Thursday, May 24, 12 99. 3 Networking Classes Server class: Creates a serverThursday, May 24, 12 100. 3 Networking Classes Server class: Creates a server Announces the server via BonjourThursday, May 24, 12 101. 3 Networking Classes Server class: Creates a server Announces the server via Bonjour Connection class:Thursday, May 24, 12 102. 3 Networking Classes Server class: Creates a server Announces the server via Bonjour Connection class: Resolves Bonjour ServicesThursday, May 24, 12 103. 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 104. 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 105. 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 106. 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 107. Thursday, May 24, 12 108. Application layersThursday, May 24, 12 109. Application layersThursday, May 24, 12 110. Application layersThursday, May 24, 12 111. Application layersThursday, May 24, 12 112. Thursday, May 24, 12 113. Down the Connection classThursday, May 24, 12 114. 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 115. Thursday, May 24, 12 116. Network messagesThursday, May 24, 12 117. Network messagesHow do we separate network messages from one another?Thursday, May 24, 12 118. Network messagesHow do we separate network messages from one another? 3 different ways:Thursday, May 24, 12 119. Network messagesHow do we separate network messages from one another? 3 different ways:1) Make all messages have the same lengthThursday, May 24, 12 120. Network messagesHow do we separate network messages from one another? 3 different ways:1) Make all messages have the same length2) Append a marker to each messageThursday, May 24, 12 121. Network messagesHow do we separate network messages from one another? 3 different ways:1) Make all messages have the same length2) Append a marker to each message3) Send some kind of header with some info about how long the message isThursday, May 24, 12 122. Network messagesHow do we separate network messages from one another? 3 different ways:1) Make all messages have the same length2) Append a marker to each message3) Send some kind of header with some info about how long the message isThursday, May 24, 12 123. Thursday, May 24, 12 124. 3) Send some kind of header...Thursday, May 24, 12 125. 3) Send some kind of header... Writing messagesThursday, May 24, 12 126. 3) Send some kind of header... Writing messages Convert an object into a byte array and measure its lengthThursday, May 24, 12 127. 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 128. 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 129. Reading messagesThursday, May 24, 12 130. Reading messages Read first 4 bytes and interpret those as an integer called xThursday, May 24, 12 131. 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 132. 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 133. Thursday, May 24, 12 134. Its time!Thursday, May 24, 12 135. Thursday, May 24, 12 136. FrameworksThursday, May 24, 12 137. Frameworks Low level: BSD socket libThursday, May 24, 12 138. Frameworks Low level: BSD socket libThursday, May 24, 12 139. Frameworks Low level: BSD socket lib High level: CFNetworkThursday, May 24, 12 140. Frameworks Low level: BSD socket lib High level: CFNetwork Bonjour iOS API: NSNetServices, CFNetServicesThursday, May 24, 12 141. Thursday, May 24, 12 142. Creating a serverThursday, May 24, 12 143. Creating a server We first create a stream socket that will listen for connectionsThursday, May 24, 12 144. Creating a server We first create a stream socket that will listen for connectionsCFSocketRef listeningSocket;Thursday, May 24, 12 145. Creating a server We first create a stream socket that will listen for connectionsCFSocketRef listeningSocket; using port number 0Thursday, May 24, 12 146. Creating a server We first create a stream socket that will listen for connectionsCFSocketRef listeningSocket; using port number 0 zero???? O_oThursday, May 24, 12 147. Thursday, May 24, 12 148. Lets publish the serviceThursday, May 24, 12 149. Lets publish the serviceThursday, May 24, 12 150. Thursday, May 24, 12 151. Services/Servers BrowserThursday, May 24, 12 152. Services/Servers BrowserThursday, May 24, 12 153. Thursday, May 24, 12 154. Found!Thursday, May 24, 12 155. Found!Thursday, May 24, 12 156. Thursday, May 24, 12 157. Displaying servers listThursday, May 24, 12 158. Displaying servers listThursday, May 24, 12 159. Thursday, May 24, 12 160. Please let me joinThursday, May 24, 12 161. Please let me joinThursday, May 24, 12 162. Please let me joinThursday, May 24, 12 163. Please let me joinThursday, May 24, 12 164. Please let me joinThursday, May 24, 12 165. Thursday, May 24, 12 166. The server receives the requestThursday, May 24, 12 167. The server receives the requestThursday, May 24, 12 168. Thursday, May 24, 12 169. The server welcomes youThursday, May 24, 12 170. The server welcomes youThursday, May 24, 12 171. The server welcomes youThursday, May 24, 12 172. Thursday, May 24, 12 173. The client receives the streamThursday, May 24, 12 174. The client receives the streamThursday, May 24, 12 175. Thursday, May 24, 12 176. RecapThursday, May 24, 12 177. Recap Apple Talk, TCP/IPThursday, May 24, 12 178. Recap Apple Talk, TCP/IP Bonjour flow cycle, uPNPThursday, May 24, 12 179. Recap Apple Talk, TCP/IP Bonjour flow cycle,...</p>