If you want to try using sockets then you should check out Beej's Guide to Network Programming
. It's a really good introduction to using sockets, good sense of humor, and the author was using Linux. The only thing it it's all written in C. I don't know if you've ported C code to FB before, but it's very easy once you get the hang of it.
Using sockets is easy enough. All the commands are super easy to port between Linux/Mac/Windows, just change your #include statements and if porting to Windows then just add an initial setup and final shutdown command. Also, the commands are straight forward and you can get something basic running pretty quick.
You mentioned maybe using a library. One thing I'll say is that if you can find a library that does exactly the same as what you want to do, it would probably be easier in the long run. However I can't offer any advice on network libraries because I haven't used any apart from the basic sockets that Beej describes.
Regarding TCP vs UDP, I'm not sure how much you know already. Feel free to skip the rest of this post if you know this stuff already.
TCP (Transmission Control Protocol) is intended for reliably sending a stream of data over a network. The data you send will
arrive at the other end, just as it was sent. Or the connection will time-out. It's good for sending files, webpages, text chat, log-on data, game data for turn-based games and some strategy games that are slow paced, and any other data you can think of that must
arrive, regardless of how long it takes. This does not mean TCP is slow, it is actually very fast, but is not designed for sending small packets of data at a rate of 20 packets a second. If sending small packets you'll actually only get about 5 packets a second, see Nagle's algorithm
. TCP is good for "I just want to send data, I don't care how it works".
UDP (User Datagram Protocol) is intended for quickly firing packets of data across a network and hoping they arrive. UDT is an unreliable protocol, meaning that the data is not guaranteed to arrive at the other end. In reality 95% or more of the data does arrive as it should, however you still need to allow for the 5% which can arrive out of order, have more than one copy of the same data arrive, or have no data arrive at all. What UDP does is give you more direct control over the low level packets being send over the network. This can be both a good thing and a bad one. Instead of having to wait for old data to be sent before you can send new data, you can just discard the old data. Of course you also have to make a system to monitor your data and make sure the important stuff arrives. And you have to consider network congestion and not send too many small packets when you can combine them into fewer larger packets. Long story short, UDP gives you more control to do what you want, but you have to make the systems yourself that already exist in TCP if you want them.
I've been investigating UDP vs TCP for games for, well, for a few years now. You can make up your own mind, but what I have decided on is that for games you really need
to use UDP. Only use TCP for games if ALL your data MUST arrive and your not expecting more than 5 packets per second. You can disable Nagle's algorithm, but you should try and avoid turning off key features of the protocol your using (just my opinion).
Anyway, that was a longer post than I intended to make. I hope you find it useful.
I can probably make a couple of example programs if you like. I'm getting a little rusty with networking so it might do me some good.