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 |