Archived

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

STEFAND98SER

Can I port Windows - winsock-server to Linux platform???

Recommended Posts

STEFAND98SER    122
Hi! I`m in a position where I need to build a server -using winsock WIN32 APi - and be sure that I can port it to Linux in the future,,Is it possible without major implemenation changes ? /Stefan E. Newswede Developer

Share this post


Link to post
Share on other sites
Dean Harding    546
Not so that you''d want to. Winsock itself is pretty portable, and if was a client application, I''d say no problemo. But for a server application, you''re going to want to take advantage of OS-specific features to get the best performance from your app (in particular, I/O completion ports on windows). These features, by the very nature, won''t be portable.

If you don''t have any performance requirements, then you can write it so that it''s portable. But I wouldn''t do it like that...

If I had my way, I''d have all of you shot!


codeka.com - Just click it.

Share this post


Link to post
Share on other sites
Prefect    373
Well, it always depends on what kind of server you''re talking about (as usual).

If you''re talking about something RTS-ish or even FPS-ish with no more than a handful of clients using UDP, the advantage of OS specific features probably isn''t going to be so high as to be relevant. You''ll probably have to worry more about the actual game logic.

Now if we''re talking about an MMO game, things could be quite different, but I have no experience in that area.

cu,
Prefect

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Deans got his mind set on mmorpg''s hehe.
Yes, you can port winsock ( the 1.1 subset) to other berkley sockets implementations reasonably easy, however there are about 3 things (that i can remember) that you need to be wary of.
1. All the winsock error codes start with WSA, the berkley error codes don''t, so you should abstract between the 2 with some #ifdefs.
2. ioctl() is called ioctlsocket() on windows, so you should abstract that one.
3. close() is called closesocket() on windows, so you should abastract that one also.
Other than that, just make sure you only use the winsock 1.1 subset and you''ll be fine.

Share this post


Link to post
Share on other sites