이것은 우분투 12.04에서 발생합니다. 동일한 코드가 OSX에서 잘 작동합니다.몇백 바이트 만 보내면 EAGAIN으로 send()가 실패합니다.
아래의 로그에서 SO_SNDBUF가 20440이고 EAGAIN으로 실패하기 전에 여러 send()가 성공한 것을 볼 수 있습니다.
wsmux started on port 8888
send buffer size = 20440
open wsmux:187.59.165.86-16580
send 129, result 129, errno 115
message wsmux:187.59.165.86-16580 NICK zxc5239
message wsmux:187.59.165.86-16580 USER zxc zxc zxc zxc
message wsmux:187.59.165.86-16580 JOIN #a
send 2, result 2, errno 115
send 66, result 66, errno 115
send 2, result 2, errno 115
send 42, result 42, errno 115
send 2, result 2, errno 115
send 100, result 100, errno 115
send 2, result 2, errno 115
send 43, result 43, errno 115
send 2, result 2, errno 115
send 48, result 48, errno 115
send 2, result -1, errno 11
close wsmux:187.59.165.86-16580 Resource temporarily unavailable
유일한 소켓 옵션은 TCP_NODELAY 및 O_NONBLOCK입니다. 여기에 무슨 문제가있을 수 있습니까?
문제의 코드 : 당신이 O_NONBLOCK
이있는 경우 비 블로킹 소켓을 설정하기 때문에
- https://github.com/lessandro/tcpmux/blob/f76217e1507b41da33e572fa025871f9fc38e3eb/src/wsmux.c#L43
- https://github.com/lessandro/sev/blob/13242419b0c9c285f96a84a6b5ee5fad00a2167f/sev.c#L118
로그에 쓰기 작업이 전혀 표시되지 않습니다. 처음 실패하기 전에 얼마나 많은 데이터가 성공적으로 전송됩니까? –
getsockopt (SO_SNDBUF)가 거짓이 아닌 한 @JoachimIsaksson 300 바이트는 20440 바이트 송신 버퍼에 맞을 것입니다. – lzm
원격 끝 (두 번째 블록의 10 패킷)에서 모든 것이 올바르게 수신되었습니다. – lzm