Skip to content

Commit

Permalink
[apps] Fixed nonblocking client example (#1973)
Browse files Browse the repository at this point in the history
- Fixed setting SRTO_RCVSYN and SRTO_SNDSYN to 0.
- Print reject reason.
  • Loading branch information
maxsharabayko authored Apr 29, 2021
1 parent 782a27f commit 61dda69
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/example-client-nonblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main(int argc, char** argv)
{
int ss, st;
struct sockaddr_in sa;
int yes = 1;
const int no = 0;
const char message [] = "This message should be sent to the other side";

if (argc != 3) {
Expand Down Expand Up @@ -66,8 +66,8 @@ int main(int argc, char** argv)
}

printf("srt setsockflag\n");
if (SRT_ERROR == srt_setsockflag(ss, SRTO_RCVSYN, &yes, sizeof yes)
|| SRT_ERROR == srt_setsockflag(ss, SRTO_SNDSYN, &yes, sizeof yes))
if (SRT_ERROR == srt_setsockflag(ss, SRTO_RCVSYN, &no, sizeof no)
|| SRT_ERROR == srt_setsockflag(ss, SRTO_SNDSYN, &no, sizeof no))
{
fprintf(stderr, "SRTO_SNDSYN or SRTO_RCVSYN: %s\n", srt_getlasterror_str());
return 1;
Expand Down Expand Up @@ -101,7 +101,7 @@ int main(int argc, char** argv)
SRT_SOCKSTATUS state = srt_getsockstate(ss);
if (state != SRTS_CONNECTED || rlen > 0) // rlen > 0 - an error notification
{
fprintf(stderr, "srt_epoll_wait: %s\n", srt_getlasterror_str());
fprintf(stderr, "srt_epoll_wait: reject reason %s\n", srt_rejectreason_str(srt_getrejectreason(rready)));
return 1;
}

Expand Down

0 comments on commit 61dda69

Please sign in to comment.