-t parameter implemented

This commit is contained in:
tkarrass 2013-11-02 20:10:57 +01:00
parent 7ab8eb1b6b
commit 562e1942d4
2 changed files with 4 additions and 3 deletions

View File

@ -23,7 +23,8 @@ int parseArgs(struct prog_info *pinfo, int argc, char **argv) {
printf( " -c <num> run in client mode\n");
printf( " num is the column offset to use.\n");
printf( " -p <port> use the specified port\n");
printf( " -t <fps> when in server mode: update <fps> times per second\n");
printf( " -t <fps> when in server mode: update <fps> 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;
}

View File

@ -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;