I prefer translating such code into Pascal, because then you can take advantage of FPC's system independend socket interface, allowing great portability.

Of course, this might be too much work. In such case, translating the headers is the best option. Instead of linking to a library you link the .o files (use $l instead of $linklib).