[Prev][Next][Index][Thread]

sending non-blocking on sockets



Hi everyone,

I'm trying to send fairly large amounts of data over a socket
(110K a go, several times a second, it's video).

I want to send non-blocking, that is I check with select() whether
I can send, call send with the data, and see how much went. Then
I go off and do something else, then repeat until all the data has gone.


The Linux manpage for send() says that I can either set the descriptor
to non-blocking with fcntl(), or use the flag argument to send() with
MSG_DONTWAIT.

The OSKit posix stuff doesn't have O_NONBLOCK, so I tried the second
option. This doesn't seem to work, and digging about in the source
(oskit/freebsd/src/sys/kern/uipc_socket.c, sosend()), it looks as if
MSG_DONTWAIT and O_NONBLOCK (with looks like it turns into SS_NBIO)
do different things.


Needless to say, I don't really understand what's going on, but I seem
to be stuck.
Could anyone wave me in the right direction?

Thanks,
Ian