Search Unity

0MQ or NetMQ - anyone tried these, or can recommend a different networking library?

Discussion in 'Multiplayer' started by jc_lvngstn, Aug 18, 2013.

  1. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    I've been using my own tcp/ip sockets based code for a bit. It handled sending/recieving, buffering, and also serialization. One of the parts that was "fun" was reassembling the messages I send. Not to get into too many details, basically the message consists of a header with the size of the message, and the message type (a byte), followed by the serialized data. After receiving enough data to generate a full message to be deserialized, it then dumped the message on a queue to be handled by the main server/client thread, and goes back to handling more incoming data.

    I felt like it was a little clunky, so I've switched to using the TCPClient and listener.

    I could probably stick with the current approach, but I do not want to get bogged down in reinventing the wheel. I'm not a networking guru, and there are probably some gotchas that I haven't even encountered yet. While I'm sure there is some merit to becoming an expert on this, I would really like to get my shi er main project moving a little faster :)

    I did some reading on ZeroMQ and NetMQ, and was curious if anyone had tried these, or could recommend an alternative library that handles async communication, with my own serialization, etc etc.
    Thanks!

    [Edit] Unfortunately, NetMQ is out because it only supports .Net 4.0+. Frustrating, especially since .net 3.5 has only been out for SIX years.
     
    Last edited: Aug 18, 2013
  2. eskimojoe

    eskimojoe

    Joined:
    Jun 4, 2012
    Posts:
    1,440
    Did you try SmartFox Server or Photon Server?
     
  3. fholm

    fholm

    Joined:
    Aug 20, 2011
    Posts:
    2,052
    Message queue libraries are built for high throughput (as in bandwidth) and usually for high throughput on LAN, they are not built for what you need: fast request/reply over WAN.
     
  4. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Haven't looked at SmartFox server or Photon, I will.
    fholm, is this due to the delivery mechanism? I would have thought using those libraries, with tcp, would work fine especially since I use my own serialization and just send/receive an array of bytes.
     
  5. landon912

    landon912

    Joined:
    Nov 8, 2011
    Posts:
    1,579
    I strongly recommend Photon Cloud if you don't need an authoritative server and can deal with a "master client"
     
  6. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Unfortunately, I do need an authoritative server. I have my own right now, and my solution may be fine, it's basically using the TcpClient from the .net framework to stream my data. But I was poking around and thought the NetMQ was pretty slick and straightforward to use, and couldn't help but wonder if there were other alternatives.
     
  7. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,067
    If you can, tell us more about what you want to achieve. You can make Photon authoritative, so it save you some work.
    I won't try to sell it to you if I don't see a fit :)
     
  8. TaiChiAnt

    TaiChiAnt

    Joined:
    May 7, 2013
    Posts:
    6
    Sorry for necro-bump.

    I found a version of netmq that works for .net 3.5
    https://github.com/JamesWHurst/netmq/tree/Net35CompatFix

    However, I'm having problems trying to get it to work on web player build.
    It seems that instantiating NetMqContext will call a Tcp.Listen(). Tcp listen is not allowed for web player builds...

    Any help is appreciated. Thanks.
     
  9. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Check out uLink, very powerful and very well documented.
    We use it for an authoritative server for our game, works great with physics.
     
  10. TaiChiAnt

    TaiChiAnt

    Joined:
    May 7, 2013
    Posts:
    6
    uLink looks very promising, unfortunately its licensing is unsuitable for my project requirements :/
     
  11. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    They were going to have a free version with limited CCU, but I haven't seen any update on this.