Ok - this is not multithreaded or anything, just a simple “echo” server and client (just baby steps - trying to understand simple before I move on from there). I start the server first, then the client in a different shell. The server gets the message, and seems to send it back, but the client never gets it?
Server:
using Sockets
port = 9999
echo_server = listen(port)
while true
@info "starting server"
sock = accept(echo_server)
@info "accepted: $(getsockname(sock))"
message = read(sock, String)
@info "read message: '$message'"
write(sock, message)
@info "message sent"
close(sock)
end
Client:
using Sockets
s = connect(9999)
@info "connected"
write(s, "hi there")
@info "message sent"
m = read(s, String)
println(m)
@info "got back: '$m'"
close(s)