Portable network code?

Started by
2 comments, last by _Josh 22 years, 4 months ago
If I used winsock and avoided the windows messaging functions, is my code portable to a linux environment? I guess my basic question is: are there any standard networking libraries that are portable across linux and windows? Edited by - _Josh on December 8, 2001 4:31:54 PM
Advertisement
Most of the winsock functions are pretty much standard BSD sockets (which is what most everything uses these days). Just avoid the WSA* functions, of course. Oh, and winsock 2 has a few extensions which you should look out for. The documentation tells you when it moves away from the standard though.

codeka.com - Just click it.
Personal opinion here:

While it''s possible to have a single piece of sockets code that works for windows and unix, it''s probably not going to yield the best performance or cleanest use on both platforms. If I were you, I''d create one class that''s designed to fit into your application model on windows, and one that fits for unix.

Just my thoughts.
I agree with that, for the most part. If you''re writing the client, then going for portability is OK, but on the server... well, I wouldn''t aim for any part of the server being particulaly portable, myself. Most platforms have vastly different strengths and weaknesses when it comes to high performance multi-threaded applications, and I''d tailor everything (except for core game logic, of course) to run solely on that one platform.


codeka.com - Just click it.

This topic is closed to new replies.

Advertisement