mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 07:46:38 +00:00
Add setsockopt SO_REUSEADDR
Original commit message from CVS: Add setsockopt SO_REUSEADDR
This commit is contained in:
parent
db5fc95ca8
commit
3269b5d6d2
1 changed files with 6 additions and 0 deletions
|
@ -347,6 +347,7 @@ static gboolean
|
|||
gst_udpsrc_init_receive (GstUDPSrc *src)
|
||||
{
|
||||
guint bc_val;
|
||||
gint reuse=1;
|
||||
bzero (&src->myaddr, sizeof (src->myaddr));
|
||||
src->myaddr.sin_family = AF_INET; /* host byte order */
|
||||
src->myaddr.sin_port = htons (src->port); /* short, network byte order */
|
||||
|
@ -356,6 +357,11 @@ gst_udpsrc_init_receive (GstUDPSrc *src)
|
|||
perror("socket");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (setsockopt(src->sock, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) {
|
||||
perror("setsockopt");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (bind (src->sock, (struct sockaddr *) &src->myaddr, sizeof (src->myaddr)) == -1) {
|
||||
perror("bind");
|
||||
|
|
Loading…
Reference in a new issue