hi all,

i wander the code below is right or not:

A. thread for receiving data from multicast address

DWORD WINAPI recv_thread(LPVOID lp)
{
 AVIOContext * io_ctx = NULL;
 unsigned char recv_buffer[1024];

 int ret = avio_open2( &io_ctx, 
"udp://224.124.0.1:5000?multicast=1&ttl=16&reuse=1&pkt_size=256", 
AVIO_FLAG_READ_WRITE, NULL, NULL);
 ret = url_setbufsize(io_ctx, 4096); 

ret = avio_read(io_ctx, recv_buffer, sizeof(recv_buffer)); // is this okay?

 avio_close(io_ctx);

 return 0;
}

B. thread to send data to multicast address.

DWORD WINAPI send_thread(LPVOID lp)
{
 AVIOContext * io_ctx = NULL;
 uint8_t snd_buf[] = "abcdef";

 int ret = avio_open2( &io_ctx, 
"udp://224.124.0.1:5000?multicast=1&ttl=16&reuse=1&pkt_size=256", 
AVIO_FLAG_READ_WRITE, NULL, NULL);
 ret = url_setbufsize(io_ctx, 4096);

 avio_write(io_ctx, snd_buf, sizeof(snd_buf)); // is this okay?

 avio_close(io_ctx);

 return 0;
}
is anyone could tell me the result. thanks.
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to