Hi all.
I'm currently using libevent to try write a "relay server". What I mean
by relay server is that it would sit in the middle of a client and a
server and relay packets between them.In my current implementation I
have not used write events at all. I've set the socket to be nonblocking
and simply called send(). I log an error if send returns EWOULDBLOCK,
but so far (with a lot of testing) this has not happened.
I'm doing the development on a Linux machine and from what I've read
about TCP Autotuning on Linux, it is understandable why sending does
not block. None the less, I'm sure there are cases that would cause my
server to block on send(). What conditions would cause blocking?
Also I'm not sure what to do when blocking occurs. For example if I
receive data from a client and then attempt to send it to the server,
but it blocks. The only thing I can think of is to delete the read event
of the client (so that I do not receive any more data), register a write
event for the server. Once my write event is called I can again add a
read event for the client because I would be able to write to the server
without blocking.
My above solution sound very complex, which is why I'd appreciate any
advice on how to handle this situation.
Thanks in advance.
Pico
_______________________________________________
Libevent-users mailing list
[email protected]
http://monkey.org/mailman/listinfo/libevent-users