Yes. I've solved my issue.

It seems that the eventlet monkey_patched sockets do not throw any
kind of exception when a socket is closed. Since I'm transferring
binary data and not ascii, an EOF would not be very logical. I was
expecting an error and I also did not know if I the sockets were in
Synchronous or Non-Synchronous mode.

Also, eventlet does not have any documentation regarding the native
sockets, which complicated things.

I have added the necessary logic to check for the empty bytestrings
and solved my issue.

Thank you anyway.

On 19 June 2018 at 05:35, IWAMOTO Toshihiro <iwam...@valinux.co.jp> wrote:
> On Thu, 14 Jun 2018 23:42:06 +0900,
> Carlos Ferreira wrote:
>>
>> Hello to all!
>>
>> I'm having some issues regarding the use of TCP sockets in ryu apps.
>>
>> After spwaning a TCP server using
>>
>> hub.spawn(eventlet.serve, eventlet.listen((str(ip), port)), client_handler)
>>
>> where the client_handler will handle each client request, it seems
>> that the TCP Socket passed to the handler, does not work as predicted.
>>
>> I understand that the sockets are in non-blocking mode and that
>> eventlet patches the sockets to make them workable with the coroutines
>> mechanism, but it seems that the socket does not raise any kind of
>> exception when there's zero data to be read from the underlying
>> buffer. If my app keeps calling the recv method from a socket object,
>> the recv will continue to return zero.
>>
>> Is ryu modifying the behaviour of the TCP sockets or is there a
>> specific way to use TCP Sockets in Ryu?
>
> The question is not specific to ryu but rather a generic eventlet question.
>
> As long as you are using the monkey_patch'd version of socket object,
> it should behave as a usual blocking I/O.
>
> Usually zero bytes reads mean EOF. Please check your code.
>
> --
> IWAMOTO Toshihiro



-- 

Carlos Miguel Ferreira
Researcher at Telecommunications Institute
Aveiro - Portugal
Work E-mail - c...@av.it.pt
Skype & GTalk -> carlosmf...@gmail.com
LinkedIn -> http://www.linkedin.com/in/carlosmferreira

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to