Jump to content

Initialize Stream/Blob with native data from winsock recvfrom function


photo

Recommended Posts

Hi,

Please confirm if I can initialize Stream/Blob object in thats way:

char RecvBuf[1024];
recvfrom(RecvSocket, RecvBuf, 1024, 0, (SOCKADDR *)& SenderAddr, &SenderAddrSize);

Unigine::BlobPtr temp_blob = Unigine::Blob::create();
temp_blob->resize(1024);
temp_blob->puts(RecvBuf);

Do I can pass native data from recvfrom winsock function in that's way ? 

ps. 
At the moment I can't get this data as socket->readStream(temp_blob->getStream(), 1024); because I can't get client port (UDP which sends data by sendto method) from Unigine socket. So I looking for workaround for it.

Cheers,
Jan 

Link to comment

Hi Jan,

Do I can pass native data from recvfrom winsock function in that's way ?
I think it might be better if you used temp_blob->write(RecvBuf, 1024); instead of puts().

Best regards,
Alexander

  • Like 1
Link to comment
18 minutes ago, alexander said:

Hi Jan,

Do I can pass native data from recvfrom winsock function in that's way ?
I think it might be better if you used temp_blob->write(RecvBuf, 1024); instead of puts().

Best regards,
Alexander

Thanks Alexander, I will do like that :)

Jan

Link to comment
×
×
  • Create New...