Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
25c83d44
Commit
25c83d44
authored
Nov 21, 2001
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Hopefully) fixed the network connect() bug under UNIX. I need
confirmation that I didn't break the Win32 port, please.
parent
8b949d08
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
46 deletions
+28
-46
src/input/input.c
src/input/input.c
+9
-14
src/misc/netutils.c
src/misc/netutils.c
+19
-32
No files found.
src/input/input.c
View file @
25c83d44
...
...
@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.15
6 2001/11/15 18:50:49 sam
Exp $
* $Id: input.c,v 1.15
7 2001/11/21 16:47:46 massiot
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -731,7 +731,6 @@ static void NetworkOpen( input_thread_t * p_input )
int
i_opt
;
int
i_opt_size
;
struct
sockaddr_in
sock
;
unsigned
int
i_mc_group
;
/* Get the remote server */
if
(
p_input
->
p_source
!=
NULL
)
...
...
@@ -895,15 +894,6 @@ static void NetworkOpen( input_thread_t * p_input )
return
;
}
/* Required for IP_ADD_MEMBERSHIP */
i_mc_group
=
sock
.
sin_addr
.
s_addr
;
#if defined( WIN32 )
sock
.
sin_addr
.
s_addr
=
INADDR_ANY
;
#define IN_MULTICAST(a) IN_CLASSD(a)
#endif
/* Bind it */
if
(
bind
(
p_input
->
i_handle
,
(
struct
sockaddr
*
)
&
sock
,
sizeof
(
sock
)
)
<
0
)
...
...
@@ -916,13 +906,18 @@ static void NetworkOpen( input_thread_t * p_input )
/* Join the multicast group if the socket is a multicast address */
#if defined( WIN32 )
# define IN_MULTICAST(a) IN_CLASSD(a)
#endif
/* TODO : make this compile under Win32 */
#ifndef WIN32
if
(
IN_MULTICAST
(
ntohl
(
i_mc_group
)
)
)
if
(
IN_MULTICAST
(
ntohl
(
sock
.
sin_addr
.
s_addr
)
)
)
{
struct
ip_mreq
imr
;
imr
.
imr_interface
.
s_addr
=
htonl
(
INADDR_ANY
)
;
imr
.
imr_multiaddr
.
s_addr
=
i_mc_group
;
imr
.
imr_interface
.
s_addr
=
INADDR_ANY
;
imr
.
imr_multiaddr
.
s_addr
=
sock
.
sin_addr
.
s_addr
;
if
(
setsockopt
(
p_input
->
i_handle
,
IPPROTO_IP
,
IP_ADD_MEMBERSHIP
,
(
char
*
)
&
imr
,
sizeof
(
struct
ip_mreq
)
)
==
-
1
)
{
...
...
src/misc/netutils.c
View file @
25c83d44
...
...
@@ -2,7 +2,7 @@
* netutils.c: various network functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: netutils.c,v 1.4
6 2001/11/16 00:29:52 stef
Exp $
* $Id: netutils.c,v 1.4
7 2001/11/21 16:47:46 massiot
Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Benoit Steiner <benny@via.ecp.fr>
...
...
@@ -115,54 +115,41 @@ int network_BuildLocalAddr( struct sockaddr_in * p_socket, int i_port,
char
*
psz_broadcast
)
{
#if defined( SYS_BEOS )
intf_ErrMsg
(
"error:
channel chang
ing is not yet supported under BeOS"
);
intf_ErrMsg
(
"error:
network
ing is not yet supported under BeOS"
);
return
(
1
);
#else
char
psz_hostname
[
INPUT_MAX_SOURCE_LENGTH
];
struct
hostent
*
p_hostent
;
/* Reset struct */
memset
(
p_socket
,
0
,
sizeof
(
struct
sockaddr_in
)
);
p_socket
->
sin_family
=
AF_INET
;
/* family */
p_socket
->
sin_port
=
htons
(
i_port
);
if
(
psz_broadcast
==
NULL
)
{
/* Try to get our own IP */
if
(
gethostname
(
psz_hostname
,
sizeof
(
psz_hostname
)
)
)
{
intf_ErrMsg
(
"BuildLocalAddr : unable to resolve local name : %s"
,
strerror
(
errno
)
);
return
(
-
1
);
}
p_socket
->
sin_addr
.
s_addr
=
INADDR_ANY
;
}
else
{
/* I didn't manage to make INADDR_ANYT work, even with setsockopt
* so, as it's kludgy to try and determine the broadcast addr
* it is passed as an argument in the command line */
strncpy
(
psz_hostname
,
psz_broadcast
,
INPUT_MAX_SOURCE_LENGTH
);
}
struct
hostent
*
p_hostent
;
/* Try to convert address directly from in_addr - this will work if
* psz_in_addr
is dotted decimal. */
/* Try to convert address directly from in_addr - this will work if
* psz_broadcast
is dotted decimal. */
#ifdef HAVE_ARPA_INET_H
if
(
!
inet_aton
(
psz_hostname
,
&
p_socket
->
sin_addr
)
)
if
(
!
inet_aton
(
psz_broadcast
,
&
p_socket
->
sin_addr
)
)
#else
if
(
(
p_socket
->
sin_addr
.
s_addr
=
inet_addr
(
psz_hostname
))
==
-
1
)
if
(
(
p_socket
->
sin_addr
.
s_addr
=
inet_addr
(
psz_broadcast
))
==
-
1
)
#endif
{
/* We have a fqdn, try to find its address */
if
(
(
p_hostent
=
gethostbyname
(
psz_hostname
))
==
NULL
)
{
intf_ErrMsg
(
"BuildLocalAddr: unknown host %s"
,
psz_hostname
);
return
(
-
1
);
/* We have a fqdn, try to find its address */
if
(
(
p_hostent
=
gethostbyname
(
psz_broadcast
))
==
NULL
)
{
intf_ErrMsg
(
"BuildLocalAddr: unknown host %s"
,
psz_broadcast
);
return
(
-
1
);
}
/* Copy the first address of the host in the socket address */
memcpy
(
&
p_socket
->
sin_addr
,
p_hostent
->
h_addr_list
[
0
],
p_hostent
->
h_length
);
}
/* Copy the first address of the host in the socket address */
memcpy
(
&
p_socket
->
sin_addr
,
p_hostent
->
h_addr_list
[
0
],
p_hostent
->
h_length
);
}
return
(
0
);
#endif
...
...
@@ -174,7 +161,7 @@ int network_BuildLocalAddr( struct sockaddr_in * p_socket, int i_port,
int
network_BuildRemoteAddr
(
struct
sockaddr_in
*
p_socket
,
char
*
psz_server
)
{
#if defined( SYS_BEOS )
intf_ErrMsg
(
"error:
channel chang
ing is not yet supported under BeOS"
);
intf_ErrMsg
(
"error:
network
ing is not yet supported under BeOS"
);
return
(
1
);
#else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment