From 562e1942d45e7101bb5deeda8349de0cdbdc8180 Mon Sep 17 00:00:00 2001 From: tkarrass Date: Sat, 2 Nov 2013 20:10:57 +0100 Subject: [PATCH] -t parameter implemented --- src/main.c | 5 +++-- src/net.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index b5df47d..c3b98ea 100644 --- a/src/main.c +++ b/src/main.c @@ -23,7 +23,8 @@ int parseArgs(struct prog_info *pinfo, int argc, char **argv) { printf( " -c run in client mode\n"); printf( " num is the column offset to use.\n"); printf( " -p use the specified port\n"); - printf( " -t when in server mode: update times per second\n"); + printf( " -t when in server mode: update times\n"); + printf( " per second. Valid range: 2 - 99\n"); printf( " no use in client mode\n"); printf("\n\n"); return -1; @@ -65,7 +66,7 @@ int parseArgs(struct prog_info *pinfo, int argc, char **argv) { return -6; } pinfo->fps = (int)strtol(argv[++i], NULL, 10); - if (pinfo->fps <= 0 || 50 <= pinfo->fps) { + if (pinfo->fps <= 1 || 50 <= pinfo->fps) { printf("fps invalid!\n"); return -7; } diff --git a/src/net.c b/src/net.c index 7be8287..8147d1c 100644 --- a/src/net.c +++ b/src/net.c @@ -64,7 +64,7 @@ int run_server(const struct prog_info *pinfo) { struct timespec tim; tim.tv_sec = 0; - tim.tv_nsec = 50000000; + tim.tv_nsec = 1000000000 / pinfo->fps; // Einem Socket muss das Broadcasting explizit erlaubt werden: int broadcastPermission = 1;