P2P vs Sockets: Communication on the Flash Platform

3,181 views

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,181
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • P2P vs Sockets: Communication on the Flash Platform

    1. 1. Sockets vs P2PCommunication on the Flash Platform
    2. 2. Aaron Boushley› Senior Developer at ZaaLabs, Ltd.› www.zaalabs.com› aaron@zaalabs.com› @boushley
    3. 3. Forms OfCommunication› Sockets› NetConnection + NetGroup› HTTPBased » WebService (SOAP) » HTTPService (REST)› RemoteObject (AMF)
    4. 4. High Level --Sockets› Client-Server Architecture› Flash Independent› Requires a server of some kind
    5. 5. High Level -- P2P › Peer to Peer Communication › Adobe specific implementation (RTMFP) › No server required*, all clients can communicate*P2P Setup requires a server or ip multicast to maintain the mesh.
    6. 6. Code Time...
    7. 7. Basic Sockets
    8. 8. War GamesWOPR example by Nate Beck
    9. 9. P2P Chat› Example by Tom Krcha› http://www.flashrealtime.com/simple-chat-p2p-netgroup-rtmfp/› Great demonstration of the basics of P2P
    10. 10. Forms Of The IP Stack
    11. 11. TCP vs UDP --FIGHT! TCP UDP› Header Size: 32 Bytes › Header Size: 20 Bytes› Guaranteed Order › No Guarantee on Order› Guaranteed Delivery › No Guarantee on Delivery› Uses Triple Handshake › Single Packet› IP Header Size: IPv4 ->16 Bytes IPv6 -> 40 Bytes
    12. 12. Protocols› The RTMP Family (RTMP, RTMPT, RTMPS, RTMPE, RTMFP)› AMF (Socket#writeObject/readObject)› SOAP, Plain XML, JSON› Custom (Hopefully bit packed)
    13. 13. CustomAMFJSONXMLSOAP
    14. 14. Custom Packing - Hex Binary 05 00000101 First Second Third
    15. 15. Custom Packing -Integer Hex Decimal 00 00 04 D2 1234
    16. 16. Custom Packing Encode Decode
    17. 17. Sockets vs› Communication is (more) private › Can function purely with Flash› Gets through most firewalls › Broadcasts are simpler and Bandwidth Efficient
    18. 18. PrivateCommunication› Sockets send packets directly to recipient› P2P requires directing code » Example » http://www.flashrealtime.com/directed-routing- explained-flash-p2p/› Encryption for security over the network » AS3Crypto -- https://code.google.com/p/as3crypto/
    19. 19. Sockets + P2P = <3
    20. 20. ZaaMulti
    21. 21. Questions?http://github.com/

    ×