From d097561c1ee24f20d5dd48fbe35301e8d9cc7cac Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 5 Apr 2024 02:01:34 +0100 Subject: refactor slightly --- client/main.ha | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'client') diff --git a/client/main.ha b/client/main.ha index a0c25d8..0065eb6 100644 --- a/client/main.ha +++ b/client/main.ha @@ -1,6 +1,7 @@ use fmt; use sdl2; use math; +use net; use net::dial; def CHUNKSIZE = 512; @@ -26,11 +27,17 @@ export fn main() void = { append(pictures, picture_from_surface(surf, offs[i])); }; + const conn = match(dial::dial("tcp","localhost","41460")) { + case let c: net::socket => yield c; + case let err: net::error => + fmt::fatal("couldn't connect to server:",net::strerror(err)); + }; + let dstate = drawing_state { drawing = false, pos = (0,0), pictures = pictures, - conn = dial::dial("tcp","localhost:41460","unknown")!, + conn = conn, }; let camera_pos: pos = (25, 50); -- cgit v1.2.3