0

I am trying to build a video streaming app with minimum delay "and some image processing is going to be done" for that I am capturing frames using openCV and sending the data of the mat object to the client who should be able to view them. these messages are large chunks of data 230399 bytes exactly for my current configuration I manged to send mat objects before and deserialize and view them using TCP stream sockets but I had problems with message boundaries so I moved to SCTP sockets but now the problem is I can't send messages of more than 1999 bytes of data. The code I am using for socket creation is

ServerSocketFileDiscriptor= socket( AF_INET, SOCK_STREAM,IPPROTO_SCTP );
        bzero( (void *)&serverAddress, sizeof(serverAddress) );
        serverAddress.sin_family = AF_INET;
        serverAddress.sin_addr.s_addr = htonl( INADDR_ANY );
        serverAddress.sin_port = htons(29008);
        bind( ServerSocketFileDiscriptor(structsockaddr*)&serverAddress,sizeof(serverAddress) );

    /* Maximum of 1 streams will be available per socket */
        memset( &message, 0, sizeof(message) );
        message.sinit_num_ostreams = 1;
        message.sinit_max_instreams = 1;
        message.sinit_max_attempts = 2;
        setsockopt( ServerSocketFileDiscriptor, IPPROTO_SCTP, SCTP_INITMSG,
                &message, sizeof(message) );

        listen( ServerSocketFileDiscriptor, 5 );

and the code I am using to send messages is

    int status=sctp_sendmsg( clientSocketFileDiscriptor, (void *)buffer, (size_t)strlen(mystr), NULL, 0, 0, 0, 0 /* stream */, 0, 0 );
   cout <<status<<"....................................."<<endl;
  • 1
    The appearance of strlen() in code that is supposed to transfer video stream data does not exacty fill me with confidence:( – Martin James Jan 20 '16 at 14:46
  • Then, how long is strlen(mystr)? And what is the result in status? Did you get the 1999 from there? – Ctx Jan 20 '16 at 14:47
  • It's not the actual code but the tests I did to get this exact number is experimenting withe a uchar array which is the same data type of the openCV frame data segment and I got up to 1999 bytes and the send recive copination worked like magic untill I got to the number 2000 and all went down the hill from there sctp_sendmsg always is returning -1 when I get to 2000 or more uchars. Thanks for your intrest @MartinJames – Mohammad Aftal Jan 20 '16 at 15:13

0 Answers0