[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2021-01-05 Thread Malversán
Malversán added the comment: That means the core code also works for SOCK_RAW sockets. It's only limited by explicit socket type checks at a higher level. As a curious note (not related to the issue), I'm also using the SOCK_SEQPACKET connection created with BaseEventLoop to access a custom

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2021-01-05 Thread John Beeler
John Beeler added the comment: For what it's worth, a library I use currently hacks in this functionality by accessing the private method _create_connection_transport directly. This is done to allow a SOCK_RAW to be passed (which is itself required to then enable asyncio to be used for

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-11-05 Thread Malversán
Malversán added the comment: I agree. Your question about potential message size overflow should be tested (either for recv() and recvmsg()). Could you please link the resource where you found the recommendation of using recvmsg() over recv() for SOCK_SEQ_PACKET? --

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-11-05 Thread Andrew Svetlov
Andrew Svetlov added the comment: My point is: without a deep understanding we cannot "just enable" a new protocol. The evidence that it works in some limited scenarios is not enough for opening the can of worms. It is true for seqpacket, and especially true for other even not discussed

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-11-04 Thread Malversán
Malversán added the comment: In my scenario that buffer overrun never happens, maybe because I use messages that are not big enough to overflow the default recv() buffer size. But I think I can confirm that multiple messages are never received in an atomic read, even if they are being issued

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-11-04 Thread Andrew Svetlov
Andrew Svetlov added the comment: Can recv() get two messages at once? What is the behavior if the buffer size passed into recv() is smaller than the message length? -- ___ Python tracker

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-11-04 Thread Malversán
Malversán added the comment: I do not have the answer about getting message boundaries at lower levels, but from a high-level point of view SOCK_SEQ_PACKET gives atomic reads, with no need to check for message boundaries yourself. Every time you read from a SOCK_SEQ_PACKET socket you get an

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-11-04 Thread Andrew Svetlov
Andrew Svetlov added the comment: Another question: does SSL/TLS make sense for seqpacket? -- ___ Python tracker ___ ___

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-11-04 Thread Andrew Svetlov
Andrew Svetlov added the comment: How to get the message boundary without recvmsg()? Sorry, I'm not familiar with seqpacket. -- ___ Python tracker ___

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-11-04 Thread Malversán
Malversán added the comment: It has a certain logic to recommend recvmsg() in place of recv(), as SOCK_SEQ_PACKET is characterized by transmitting entire messages only. But it has to be noted that my current hack (described above) is working for SOCK_SEQ_PACKET sockets with no modification

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-11-04 Thread Callum Ward
Callum Ward added the comment: A matter of creating tests to allow test enabling of new socket types I could attempt, but new protocol/transport types may be beyond me. -- ___ Python tracker

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-11-04 Thread Andrew Svetlov
Andrew Svetlov added the comment: For each type, we need at least a test that creates a socket pair and successfully transfers data through the wire. I don't know what additional things are required. For example, on reading about SOCK_SEQ_PACKET I've found that recvmsg() is highly

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-11-04 Thread Callum Ward
Callum Ward added the comment: Hi Andrew, I'm a new contributor, but this sounds like a pretty cool enhancement. Would you be able to elaborate on what kind of things might be required to support each new socket type and test them in particular so I can see if I can take it on?

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-09-26 Thread Malversán
Malversán added the comment: I'm sorry to read that. I thought the report could be enough to reach whoever put that SOCK_STREAM-only checks and ask him why, when the library actually works well also with other socket types. If I ever find enough time to dive into the CPython repository I

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-09-26 Thread Andrew Svetlov
Andrew Svetlov added the comment: If you have no time for contribution -- that's fine, CPython is the Open Source project driven by volunteers. The only caveat is that the issue may wait for years before we find a champion to pick it up. For example, this particular problem is on the very

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-09-26 Thread Malversán
Malversán added the comment: In the past it took me two days to analyze asyncio code, to think up and integrate the hack I´m using for this. But I´m not kidding when I tell you that it took me two years to find a while to come here and properly report it. I'm sorry, but I never have time to

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-09-26 Thread Andrew Svetlov
Andrew Svetlov added the comment: We can implement these using the following procedure: 1. Use only one socket type per pull request 2. Add support for, e.g. SOCK_SEQPACKET to asyncio code 3. Add test(s) that checks that SOCK_SEQPACKET works fine (./Lib/test/test_asyncio folder, perhaps

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-09-26 Thread Malversán
Malversán added the comment: Certainly I have only tested it with SOCK_SEQPACKET, but apparently no one has ever tested this before with a socket type other than SOCK_STREAM. It may be worth to consider the possibility that the current asyncio implementation may also support some other

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-09-26 Thread Andrew Svetlov
Andrew Svetlov added the comment: I think if we want to support SOCK_SEQPACKET by asyncio we should do it explicitly. In the other case, we can open a can of worms: we cannot guarantee that all existing protocols are supported by asyncio seamlessly. Anyway, this is a new feature request.

[issue38285] Asyncio BaseEventLoop can support socket types other than SOCK_STREAM

2019-09-26 Thread Malversán
New submission from Malversán : Currently the BaseEventLoop class in asyncio has explicit checks to raise ValueError when creating a connection if the socket argument has a type other than SOCK_STREAM: .create_connection() .create_server() This is also applicable for class