Search Unity

  1. Unity 2019.1 beta is now available.
    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. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    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

    hbey

    Joined:
    Apr 9, 2013
    Posts:
    9
    HiSocket_unity


    How to use

    You can download unity package from here: https://github.com/hiramtan/HiSocket_unity/releases

    Features

    • 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
    Details

    • 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)
    Details
     
    mgear likes this.
  2. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,143
    @hbey Do you know if this uses TLS 1.2?