You should also set TWSocket own buffer size (Default to 1460).
frmTestCarteDSPR->udpServer->BufSize = 65536;

> maxlength = udpClient->RcvdCount;

Do not rely on RcvdCount which - as Microsoft said - is not always accurate. 
Just receive as much data as you can into your buffer. Normally since UDP is 
a datagram service, you'll get complete datagrams at once.

PS: On peut aussi me joindre sur le forum news://news.delphinaute.be/delphi
--
Participez à l'effort SSL pour ICS. Visitez 
http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Auteur du freeware ICS - Internet Component Suite
Auteur du middleware multi-tiers MidWare
http://www.overbyte.be


----- Original Message ----- 
From: "Jonathan Dumaresq" <[EMAIL PROTECTED]>
To: <twsocket@elists.org>
Sent: Wednesday, January 31, 2007 5:13 PM
Subject: [twsocket] streaming video client/server application


> HI,
>
> I try to make a streaming video client server application using thr 
> TWsocket component.
>
> I think i have some probleme with handling all the data that is comming on 
> the client part. On my server part, I have a callback function that if 
> fired as soon as i have a video frame is ready. this card is a mpeg4 
> compressor card, so the data fram is variable. From 248 bytes to 30K or 
> 40K. So I send it in UDP. This server is a multi streaming server I can 
> stream up to 4 channel. since i have only 1 callback for all the channel i 
> can't do it in a thread (i think). So i do this every thime i received a 
> frame:
>
> I have put a TWsocket on the form.
>
>   frmTestCarteDSPR->udpServer->Proto = "udp";
>   frmTestCarteDSPR->udpServer->Addr = 
> frmTestCarteDSPR->infoConnection[channelNum].ipAddr; // ip addr to the 
> remote host
>   frmTestCarteDSPR->udpServer->Port = 
> frmTestCarteDSPR->infoConnection[channelNum].ipPort; // remote port
>   frmTestCarteDSPR->udpServer->Connect();
>   size = 65535;
>   setsockopt(frmTestCarteDSPR->udpServer->HSocket, SOL_SOCKET , SO_SNDBUF, 
> (const char *)&size, sizeof(size)); // change the socket buffer to 65535
>   frmTestCarteDSPR->udpServer->Send((unsigned char *)DataBuf,Length); // 
> send data
>   frmTestCarteDSPR->udpServer->Close(); // close the socket
>
> I would like to know if this is a good way of doing it ??? is ther a 
> simple way or a better way of doing this ?
>
>
> on the client part, i do this in the udpClientDataAvailable
>
> maxlength = udpClient->RcvdCount;
> //debugStream << "data received = " << maxlength << endl;
> frame = new uint8_t[maxlength];
> while(byteread < maxlength)
> {
>  Len = udpClient->Receive(&frame[byteread],1460);
>  byteread += Len;
> }
> // I continue the job for displaying the video.
>
> is there a better way of doing this ? is it possible to receive all the 
> data without looping ?
>
> regards
>
> Jonathan
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to