[SDL] Non-blocking calls in SDL_net?
Bob Pendleton
bob at pendleton.com
Mon Feb 23 12:26:41 PST 2004
On Fri, 2004-02-20 at 04:47, Jorge Garcia wrote:
> Is there any way to make non-blocking calls in SDL_net? It seems that
> send/receive calls wait until everything is sent or received, and you cannot
> know how many bytes are available for sending/receiving before calling. If you
> use socket sets and check them you are only guaranteed that one byte(?) is
> available and asking for more bytes in a receive call may block the thread.
> AFAIK, some socket implementations allow a non-blocking mode which is very handy
> if you don't want to mess with threads.
Take a look at the net2 library at:http://gameprogrammer.com/game.html.
Even if you don't use the library, the article and code tells you how to
do what you want. And, you don't really want to use non-blocking code.
Non-blocking code makes you poll for input which leads to serious
performance and synchronization problems.
Bob Pendleton
>
> Jorge
>
>
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
--
+---------------------------------------+
+ Bob Pendleton: writer and programmer. +
+ email: Bob at Pendleton.com +
+ web: www.GameProgrammer.com +
+---------------------------------------+
More information about the SDL
mailing list