Search Unity

Unity's tcp protocol socket plugin(open source)

Discussion in 'Multiplayer' 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,204
    @hbey Do you know if this uses TLS 1.2?