Archived

This topic is now archived and is closed to further replies.

_Josh

Portable network code?

Recommended Posts

_Josh    122
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

Share this post


Link to post
Share on other sites
Dean Harding    546
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.

Share this post


Link to post
Share on other sites
JonStelly    127
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.

Share this post


Link to post
Share on other sites
Dean Harding    546
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.

Share this post


Link to post
Share on other sites