Search Unity

Can UNET use TCP fallback?

Discussion in 'UNet' started by grrosegr, Jul 2, 2015.

  1. grrosegr

    grrosegr

    Joined:
    Nov 18, 2012
    Posts:
    11
    I'm working on a corporate network that blocks incoming UDP packets. While LAN works, I've noticed that playing with the relay server fails, and some investigation with Wireshark revealed it to be that Unity Multiplayer seems almost entirely UDP based.

    1) Are there any plans to implement TCP tunnelling for cases like that, or any workaround ways to do it myself?

    2) Also, is there any way we can swap out Unity Multiplayer's current transport layer for a custom one?

    For reference, see the article https://alexfreska.svbtle.com/webrtc-not-quite-magic and scroll to the bottom. I believe the same stuff that applies to WebRTC applies here.
     
  2. Necromantic

    Necromantic

    Joined:
    Feb 11, 2013
    Posts:
    116
    Yes, Unity Multiplayer is mostly UDP with different reliability settings and for WebGL Websockets.
    As far as I know there is no way to use TCP with the new Networking System. You could use a proxy that just forwards all the UDP data over a TCP connection but that would probably be a bitch to do.
     
  3. grrosegr

    grrosegr

    Joined:
    Nov 18, 2012
    Posts:
    11
    @Necromantic thanks!

    Now I'd be interested to hear if there are any plans to implement TCP in the future, or at least if there is a way to switch out the transport layer. Yeah, a local proxy would work, but ideally we wouldn't have to do that.
     
  4. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Yes we have plans to support TCP, when? It is one of priority task... And thanks for reference. WebSocket support implemented with the same idea inside. User still sending messages, but internally it is a web-socket/tcp tunneling.
     
  5. isidro02139

    isidro02139

    Joined:
    Jul 31, 2012
    Posts:
    72
    FYI there is an IRC channel now on irc.freenode.net (#unity3d-unet).

    Also, some shared resources are gathered here: https://goo.gl/UmBBpM
     
  6. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    472
    For games that only need reliable communication, like ours, it seems to me that the websockets option should be available for all platforms, as that sends and receives via TCP. What is the advantage of creating a TCP QoS vs sending Unreliable QoS through websockets?
     
  7. notseanr

    notseanr

    Joined:
    Jan 15, 2016
    Posts:
    22
    It should be possible to do HLAPI over TCP using "external connections". This project has some examples of using them:

    http://forum.unity3d.com/threads/unet-hlapi-sample-custom-connection-classes.375595/

    Essentially you would create a TcpNetworkConnection class derived from NetworkConnection, and connect it yourself using TCP, then add it to the NetworkServer and NetworkClient using AddExternalConnection. Then override the TransportSend() and TransportRecieve() functions to route to a TCP socket that it owns.
     
    JosephHK and chrismarch like this.