memset (&hints, 0, sizeof( hints ));
hints.ai_family = family;
hints.ai_socktype = SOCK_DGRAM;
+ hints.ai_protocol = protocol;
hints.ai_flags = AI_PASSIVE;
if (host && !*host)
for (const struct addrinfo *ptr = res; ptr != NULL; ptr = ptr->ai_next)
{
int fd = net_Socket (obj, ptr->ai_family, ptr->ai_socktype,
- protocol ? protocol : ptr->ai_protocol);
+ ptr->ai_protocol);
if (fd == -1)
{
msg_Dbg (obj, "socket error: %m");
return setsockopt( fd, level, cmd, &(int){ dscp }, sizeof (int));
}
-
+#undef net_ConnectDgram
/*****************************************************************************
- * __net_ConnectDgram:
+ * net_ConnectDgram:
*****************************************************************************
* Open a datagram socket to send data to a defined destination, with an
* optional hop limit.
*****************************************************************************/
-int __net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
- int i_hlim, int proto )
+int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
+ int i_hlim, int proto )
{
struct addrinfo hints, *res, *ptr;
int i_val, i_handle = -1;
memset( &hints, 0, sizeof( hints ) );
hints.ai_socktype = SOCK_DGRAM;
+ hints.ai_protocol = proto;
msg_Dbg( p_this, "net: connecting to [%s]:%d", psz_host, i_port );
{
char *str;
int fd = net_Socket (p_this, ptr->ai_family, ptr->ai_socktype,
- proto ? proto : ptr->ai_protocol);
+ ptr->ai_protocol);
if (fd == -1)
continue;
return i_handle;
}
-
+#undef net_OpenDgram
/*****************************************************************************
- * __net_OpenDgram:
+ * net_OpenDgram:
*****************************************************************************
* OpenDgram a datagram socket and return a handle
*****************************************************************************/
-int __net_OpenDgram( vlc_object_t *obj, const char *psz_bind, int i_bind,
- const char *psz_server, int i_server,
- int family, int protocol )
+int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, int i_bind,
+ const char *psz_server, int i_server,
+ int family, int protocol )
{
if ((psz_server == NULL) || (psz_server[0] == '\0'))
return net_ListenSingle (obj, psz_bind, i_bind, family, protocol);
memset (&hints, 0, sizeof (hints));
hints.ai_family = family;
hints.ai_socktype = SOCK_DGRAM;
+ hints.ai_protocol = protocol;
val = vlc_getaddrinfo (obj, psz_server, i_server, &hints, &rem);
if (val)
for (struct addrinfo *ptr = loc; ptr != NULL; ptr = ptr->ai_next)
{
int fd = net_Socket (obj, ptr->ai_family, ptr->ai_socktype,
- protocol ? protocol : ptr->ai_protocol);
+ ptr->ai_protocol);
if (fd == -1)
continue; // usually, address family not supported