Skip to content

Commit

Permalink
[apps] Examples: wait 1 sec until receiver completes (#2572).
Browse files Browse the repository at this point in the history
  • Loading branch information
fujitatomoya authored Dec 8, 2022
1 parent ba67d36 commit b6f1e9c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion examples/test-c-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ int main(int argc, char** argv)
}

printf("srt setsockflag\n");
srt_setsockflag(ss, SRTO_SENDER, &yes, sizeof yes);
if (SRT_ERROR == srt_setsockflag(ss, SRTO_SENDER, &yes, sizeof yes)
{
fprintf(stderr, "srt_setsockflag: %s\n", srt_getlasterror_str());
return 1;
}

// Test deprecated
//srt_setsockflag(ss, SRTO_STRICTENC, &yes, sizeof yes);
Expand Down Expand Up @@ -87,6 +91,7 @@ int main(int argc, char** argv)
}


sleep(1); // 1 second to give it enough time to receive all messages
printf("srt close\n");
st = srt_close(ss);
if (st == SRT_ERROR)
Expand Down
11 changes: 10 additions & 1 deletion examples/test-c-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ int main(int argc, char** argv)
}

printf("srt setsockflag\n");
srt_setsockflag(ss, SRTO_RCVSYN, &yes, sizeof yes);
if (SRT_ERROR == srt_setsockflag(ss, SRTO_RCVSYN, &yes, sizeof yes)
{
fprintf(stderr, "srt_setsockflag: %s\n", srt_getlasterror_str());
return 1;
}

printf("srt bind\n");
st = srt_bind(ss, (struct sockaddr*)&sa, sizeof sa);
Expand All @@ -75,6 +79,11 @@ int main(int argc, char** argv)
printf("srt accept\n");
int addr_size = sizeof their_addr;
int their_fd = srt_accept(ss, (struct sockaddr *)&their_addr, &addr_size);
if (their_fd == SRT_INVALID_SOCK)
{
fprintf(stderr, "srt_accept: %s\n", srt_getlasterror_str());
return 1;
}

int i;
for (i = 0; i < 100; i++)
Expand Down

0 comments on commit b6f1e9c

Please sign in to comment.