Add setsockopt SO_REUSEADDR

Original commit message from CVS:
Add setsockopt SO_REUSEADDR
This commit is contained in:
Angel Carpintero 2003-08-20 05:35:48 +00:00
parent db5fc95ca8
commit 3269b5d6d2

View file

@ -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");