[issue33307] socket.send() fails to send large amount of bytes

2018-04-18 Thread Kaulkwappe
Kaulkwappe added the comment: Thank you for your answer Christian. Indeed it seems a little more complex. As I worked with Non-TLS sockets before it looked like unexpected behaviour to me as on non-blocking sockets socket.send() would normally return 0 when no data

[issue33307] socket.send() fails to send large amount of bytes

2018-04-18 Thread Christian Heimes
Christian Heimes added the comment: The same way as with any other non-blocking I/O system. You have to keep track how much data you have already sent and repeat non-blocking send() until you have succeeded. With TLS/SSL it's even more complex, because a send() also

[issue33307] socket.send() fails to send large amount of bytes

2018-04-18 Thread Kaulkwappe
Kaulkwappe added the comment: But why does socket.send() throws an exception in this case only when sending a large amount of bytes? That would mean it is impossible to send large amount of bytes over SSL sockets as it would fail everytime. -- status: closed

[issue33307] socket.send() fails to send large amount of bytes

2018-04-18 Thread Christian Heimes
Christian Heimes added the comment: Inada is correct. This is the expected and documented behavior for non-blocking SSLSockets, see https://docs.python.org/3/library/ssl.html#ssl-nonblocking . -- resolution: -> not a bug stage: -> resolved status: open -> closed

[issue33307] socket.send() fails to send large amount of bytes

2018-04-18 Thread Kaulkwappe
Kaulkwappe added the comment: Sorry for the misunderstanding, here is the complete example: socket.setblocking(0) try: buffer = socket.recv() if not buffer: break except OSError: bytes_sent = socket.send(b'a' * 32 * 1024 *

[issue33307] socket.send() fails to send large amount of bytes

2018-04-18 Thread INADA Naoki
INADA Naoki added the comment: Isn't it an expected behavior of SSL with nonblocking socket? What's wrong? -- nosy: +inada.naoki ___ Python tracker

[issue33307] socket.send() fails to send large amount of bytes

2018-04-18 Thread Kaulkwappe
New submission from Kaulkwappe : socket.setblocking(0) socket.send(b'a' * 32 * 1024 * 1024) In the example above socket.send() fails with this error: Error in connection handler Traceback (most recent call last): File