diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-07-20 01:50:14 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-07-20 01:50:14 -0300 |
commit | 8693eef8febde4df90b7fbd1fb9ac813b132fa50 (patch) | |
tree | 088258d6333d54a6b90f331d3b723ae824110679 /src/server/client.cpp | |
parent | 7620a0b1c080f7b6315e796d29e324bdca98484b (diff) | |
download | jet-8693eef8febde4df90b7fbd1fb9ac813b132fa50.tar.gz jet-8693eef8febde4df90b7fbd1fb9ac813b132fa50.zip |
Wrap external functionality into classes
Diffstat (limited to 'src/server/client.cpp')
-rw-r--r-- | src/server/client.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/client.cpp b/src/server/client.cpp index d6fc0fc..45f7501 100644 --- a/src/server/client.cpp +++ b/src/server/client.cpp @@ -2,15 +2,15 @@ #define pos(x, y) (x) + (y) * window_w struct Client { - int sockfd; + Socket io; Point cursor; Point window_start; - Client(const Buffer &b) : cursor(b), window_start(cursor) {} + Client(const Buffer &b, int fd) : io(fd), cursor(b), window_start(cursor) {} void parse_message() { int8_t message[MAX_MSG_SIZE] = {}; - read(sockfd, message, MAX_MSG_SIZE - 1); + io.recv(message, MAX_MSG_SIZE - 1); switch (message[0]) { case OP_MOVE1: move(message[1]); @@ -58,7 +58,7 @@ struct Client { } } - write(sockfd, view, window_w * window_h); + io.send(view, window_w * window_h); delete[] view; } |