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

Reply via email to