[Libav-user] how to multicast data by udp
Mr. Xiao
34973832 at qq.com
Thu Sep 27 10:08:08 CEST 2012
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120927/e2c2902e/attachment.html>
More information about the Libav-user
mailing list