VLC_EXPORT( int, net_Connect, (vlc_object_t *p_this, const char *psz_host, int i_port, int socktype, int protocol) );
#define net_Connect(a, b, c, d, e) net_Connect(VLC_OBJECT(a), b, c, d, e)
-VLC_EXPORT( int *, net_Listen, (vlc_object_t *p_this, const char *psz_host, int i_port, int protocol) );
+VLC_EXPORT( int *, net_Listen, (vlc_object_t *p_this, const char *psz_host, int i_port, int socktype, int protocol) );
-#define net_ListenTCP(a, b, c) net_Listen(VLC_OBJECT(a), b, c, IPPROTO_TCP)
+#define net_ListenTCP(a, b, c) net_Listen(VLC_OBJECT(a), b, c, \
+ SOCK_STREAM, IPPROTO_TCP)
static inline int net_ConnectTCP (vlc_object_t *obj, const char *host, int port)
{
#endif
if( p_sys->psz_destination != NULL )
+ {
+ int type = SOCK_STREAM;
+
switch( p_sys->proto )
{
+#ifdef SOCK_DCCP
case IPPROTO_DCCP:
{
const char *code;
default: code = "RTPORTPV"; break;
}
var_SetString (p_stream, "dccp-service", code);
+ type = SOCK_DCCP;
} /* fall through */
+#endif
case IPPROTO_TCP:
id->listen.fd = net_Listen( VLC_OBJECT(p_stream),
p_sys->psz_destination, i_port,
- p_sys->proto );
+ type, p_sys->proto );
if( id->listen.fd == NULL )
{
msg_Err( p_stream, "passive COMEDIA RTP socket failed" );
rtp_add_sink( id, fd, p_sys->rtcp_mux, NULL );
}
}
+ }
if( p_fmt == NULL )
{
int *net_Listen (vlc_object_t *p_this, const char *psz_host,
- int i_port, int protocol)
+ int i_port, int type, int protocol)
{
struct addrinfo hints, *res;
memset (&hints, 0, sizeof( hints ));
+ hints.ai_socktype = type;
hints.ai_protocol = protocol;
hints.ai_flags = AI_PASSIVE;