diff --git a/src/display.c b/src/display.c index d45b3cf..938a6c9 100644 --- a/src/display.c +++ b/src/display.c @@ -66,6 +66,16 @@ void prntscreen(const struct message *msg, const struct prog_info *pinfo) { static char *img = NULL; static int w; static int h; + if (!img && msg->image) { + img = msg->image; + w = msg->width; + h = msg->height; + } + if (!img) { + printf("awaiting state ... %d\r", msg->timestamp); + return; + } + if (!init) { // printf("init start\n"); initscr(); @@ -74,14 +84,6 @@ void prntscreen(const struct message *msg, const struct prog_info *pinfo) { init = 1; // printf("init end\n"); } - if (!img && msg->image) { - img = msg->image; - w = msg->width; - h = msg->height; - } - - if (!img) - return; int frame = msg->timestamp; int right = pinfo->client_offset; @@ -92,8 +94,10 @@ void prntscreen(const struct message *msg, const struct prog_info *pinfo) { int coloffset = left-frame; for (int y=0; yheight; y++) { for (int x=left-frame; x=w?' ':img[y*w+p]); } } diff --git a/src/net.c b/src/net.c index 34fe41c..378e4a3 100644 --- a/src/net.c +++ b/src/net.c @@ -78,7 +78,6 @@ int run_server(const struct prog_info *pinfo, char *img, int w, int h) { for (;;) { //printf("sending...\n"); int numbytes; - // TODO: Hier den Messageblock erstellen und serialisieren. t++; t %= pinfo->width; @@ -99,7 +98,7 @@ int run_server(const struct prog_info *pinfo, char *img, int w, int h) { if ((numbytes = sendto(sockfd, outbuf, buflen, 0, p->ai_addr, p->ai_addrlen)) == -1) { perror("error sending"); - return -44; + return -42; } nanosleep(&tim, NULL); }