Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Nominations have been announced for this years Unity Awards. Celebrate the wonderful projects made by your peers this year and get voting! Vote here!
    Dismiss Notice
  6. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Unity's tcp protocol socket plugin(open source)

Discussion in 'Connected Games' started by hbey, Apr 2, 2018.

  1. hbey


    Apr 9, 2013

    How to use

    You can download unity package from here:


    • Support Tcp socket
    • Support Udp socket
    • Scalable byte Array
    • High-performance byte block buffer
    • Message registration and call back
    • Support byte message
    • Support protobuf message
    • AES encryption

    • Tcp and Udp are all use async connection in main thread(avoid thread blocking).
    • There are send thread and receive thread in background to process bytes(high-performance).
    • The API for ueser to send and receive message is in main thread(so that you can operate unity's component).
    • You can get current connect state by adding listener of state event.
    • You can receive message by adding listener of receive event.
    • There is a bytes array queue, can use for debugging or resend message.
    • High-performance buffer avoid memory allocation every time, and reduce garbage collection.
    • If you use Tcp socket, you should implement IPackage interface to pack or unpack message.
    • There is ping logic, but because of the bug of mono, it will throw an error on .net2.0(.net 4.6 will be fine, also you can use unity's api to get ping time, project contain some example logic)
    mgear likes this.
  2. Ben-BearFish


    Sep 6, 2011
    @hbey Do you know if this uses TLS 1.2?