Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
22651b8e
Commit
22651b8e
authored
Aug 13, 2005
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Win32] Attempt to guess best interface for multicast
may close #163
parent
fb4297bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
1 deletion
+38
-1
modules/misc/network/ipv4.c
modules/misc/network/ipv4.c
+38
-1
No files found.
modules/misc/network/ipv4.c
View file @
22651b8e
...
...
@@ -53,6 +53,7 @@
# endif
# include <winsock2.h>
# include <ws2tcpip.h>
# include <iphlpapi.h>
# define close closesocket
# if defined(UNDER_CE)
# undef IP_MULTICAST_TTL
...
...
@@ -333,16 +334,52 @@ static int OpenUDP( vlc_object_t * p_this )
{
struct
ip_mreq
imr
;
imr
.
imr_interface
.
s_addr
=
INADDR_ANY
;
imr
.
imr_multiaddr
.
s_addr
=
sock
.
sin_addr
.
s_addr
;
if
(
psz_if_addr
!=
NULL
&&
*
psz_if_addr
&&
inet_addr
(
psz_if_addr
)
!=
INADDR_NONE
)
{
imr
.
imr_interface
.
s_addr
=
inet_addr
(
psz_if_addr
);
}
#if defined (WIN32) || defined (UNDER_CE)
else
{
imr
.
imr_interface
.
s_addr
=
INADDR_ANY
;
DWORD
i_index
;
if
(
GetBestInterface
(
sock
.
sin_addr
.
s_addr
,
&
i_index
)
==
NO_ERROR
)
{
PMIB_IPADDRTABLE
p_table
;
DWORD
i
=
0
;
msg_Dbg
(
p_this
,
"Winsock best interface is %lu"
,
(
unsigned
long
)
i_index
);
GetIpAddrTable
(
NULL
,
&
i
,
0
);
p_table
=
(
PMIB_IPADDRTABLE
)
malloc
(
i
);
if
(
p_table
!=
NULL
)
{
if
(
GetIpAddrTable
(
p_table
,
&
i
,
0
)
==
NO_ERROR
)
{
for
(
i
=
0
;
i
<
p_table
->
dwNumEntries
;
i
--
)
{
if
(
p_table
->
table
[
i
].
dwIndex
==
i_index
)
{
imr
.
imr_interface
.
s_addr
=
p_table
->
table
[
i
].
dwAddr
;
msg_Dbg
(
p_this
,
"using interface 0x%08x"
,
p_table
->
table
[
i
].
dwAddr
);
}
}
}
else
msg_Warn
(
p_this
,
"GetIpAddrTable failed"
);
free
(
p_table
);
}
}
else
msg_Dbg
(
p_this
,
"GetBestInterface failed"
);
}
#endif
if
(
psz_if_addr
!=
NULL
)
free
(
psz_if_addr
);
msg_Dbg
(
p_this
,
"IP_ADD_MEMBERSHIP multicast request"
);
...
...
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