import net import strformat let socket = newSocket() socket.connect("127.0.0.1", Port(5543)) socket.send("{\"text\":\"Hello!\",\"color\":\"light_blue\",\"bold\":\"true\"}") var response = "" while true: let buffer = socket.recv(25) echo(buffer.len) if buffer.len > 0: response = fmt"{response}{buffer}" else: break echo(response) socket.close() # Here's the client code for reference. It literally just sends data then waits # for a response, but for some reason it just doesn't finish sending data until # ctrl+c is pressed