00:16
yewscion joined
00:21
yewscion_ joined,
yewscion left
00:47
yewscion joined
00:48
yewscion_ left
01:01
Manifest0 left
|
|||
botato | raku's concurrency features look neat, so I want to implement some solutions to protohackers to learn it, but I'm stuck on the first problem: protohackers.com/problem/0 | 01:29 | |
a basic tcp echo server in raku is easy enough, but this has the complication that you don't echo their message right away, but read everything until they close, and then write everything back | 01:30 | ||
01:30
kylese left
|
|||
botato | but it seems IO::Socket::Async doesn't have the concept of half-closed connection? with tcp one side or the other should be able to close connection and it is half closed meaning they won't send anymore but can still receive, then when other side closes it's fully closed | 01:31 | |
to read everything first, and then write it back all at once I try: for $conn.Supply(:bin).list.eager -> $msg {$conn.write: $msg;} | 01:32 | ||
but when the other side half-closes the connection, so for sure there won't be anything more to receive, the Supply is still open, until I close my side of the connection | 01:33 | ||
01:34
kylese joined
|
|||
botato | I try non Async socket: gist.github.com/bo-tato/7930d618b4...142eccb3b8 and `echo "adsf" | nc localhost 1337 -v`, and it seems worse, that the recv call blocks forever even though the socket is fully closed | 01:41 | |
with the Socket::Async at least when socket is fully closed the Supply closes, just when the other side has half-closed the tcp connection the Supply is still open though it should be closed at that point I think | 01:42 | ||
can test as after EOF from the echo piped to nc, it half-closes the connection, then ctrl-C the nc to fully close it | 01:44 | ||
02:01
Aedil joined
02:07
MasterDuke joined
02:34
hulk joined
02:35
kylese left
02:42
yewscion left
03:11
yewscion joined
03:15
hulk left,
kylese joined
03:16
yewscion left
03:18
MasterDuke left
|
|||
timo | github.com/libuv/libuv/issues/3449 harumpf | 03:41 | |
botato | my bad if testing with nc you need -q0 so it sends half close as soon as it reads EOF | 04:37 | |
interesting issue, but here we don't have any RST flag | |||
echo server with IO::Socket::Async: gist.github.com/bo-tato/1f0a264c78...41217561d0 tcpdump log: gist.github.com/bo-tato/45262edebb...fa55634e24 as soon as it gets Fin flag from client, it sends back Fin and closes connection, never writing back the message | 04:40 | ||
echo server that passes the protohackers.com tests: `socat tcp-l:1337,fork,reuseaddr exec:cat` with tcpdump: gist.github.com/bo-tato/4b7b092cb5...c3bbbbe045 after it gets Fin from client it doesn't respond with Fin right away, but echoes the message back, then closes it's side with Fin | 04:42 | ||
is that possible with current raku socket library? |