Bill Kelly
2/11/2005 6:34:00 AM
Hi,
From: "Jeff Davis" <jdavis-list@empires.org>
>
> I am writing an application and my design is for a non blocking tcp
> server. I have written non blocking network apps in C before.
>
> I am having trouble digging through the standard library. I have done
> this before in C with no problems. Are there some basic wrappers for the
> normal C functions and constants? I couldn't even find the F_SETFL
> constant to change the socket descriptor to non blocking. The constants
> seem to be all over the place (some in Socket, but I also need
> File::NONBLOCK, which is named differently than O_NONBLOCK...). When
> reading the documentation it's asking for a packed sockaddr to be passed
> to connect.
I use, for ex.
require 'fcntl'
# ...
sock.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)
sent = sock.send(str, 0)
# ...
HTH,
Regards,
Bill