LLAPI vs. pure C#.NET sockets

I’ve been playing with unity’s HLAPI a bit, and while it does take care of a lot of the grunt work, it can be confusing at times and just plain too restrictive at others. So now i’m looking at the LLAPI and it just seems like a very thin layer on top of TCP sockets. Is there some advantage of using the LLAPI over C#.NET socket library (I can’t see any but I was wondering what others think)?

Joe is correct.

As an aside, you can use UDP from C# to roll your own protocol.


The problem with C# .NET will most likely be is performance. The LLAPI is written in C/C++ and is optimized for the usual use case. And no, LLAPI is not based on TCP. C# part should run on lower performance because most of the stuff happens in C# side and not C++ side.

Not to mention a new/upgraded LLAPI is being made which is able to handle loads of hundreds of megabytes per second.

Edit: I’ve done some research on my own. The LLAPI is really flexible, manages things you may not want or know how to manage in unity (threads, etc). I’ve also looked under the hood at the HLAPI (which you can download here). I found it to be a jungle of odd commands and assumed use cases. I’m sure it has uses, and it may be necessary if you’re very green, but writing your own classes using the LLAPI, seems easier than, say, learning all about how the NetworkManager interacts with the NetworkIdentity, or figuring out the subtle differences between the NetworkClient and the NetworkServer. As far as performance, it seems like the HLAPI is entirely built on the LLAPI (as the docs say, and of course as would be expected), so you should lose nothing by bypassing it and dealing directly with the LLAPI.

Of course, this is a half-baked opinion, so if you find this and disagree, please let me know :slight_smile: