Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
d9906f43
Commit
d9906f43
authored
Feb 14, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make some room for !TCP connection-oriented protocols
parent
4abef78f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
include/vlc_network.h
include/vlc_network.h
+9
-4
src/network/tcp.c
src/network/tcp.c
+7
-5
No files found.
include/vlc_network.h
View file @
d9906f43
...
...
@@ -70,20 +70,25 @@ extern "C" {
/* Portable networking layer communication */
int
net_Socket
(
vlc_object_t
*
obj
,
int
family
,
int
socktype
,
int
proto
);
#define net_ConnectTCP(a, b, c) __net_ConnectTCP(VLC_OBJECT(a), b, c)
#define net_OpenTCP(a, b, c) __net_ConnectTCP(VLC_OBJECT(a), b, c)
VLC_EXPORT
(
int
,
__net_ConnectTCP
,
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
)
);
VLC_EXPORT
(
int
,
__net_Connect
,
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
socktype
,
int
protocol
)
);
VLC_EXPORT
(
int
*
,
net_Listen
,
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
family
,
int
socktype
,
int
protocol
)
);
VLC_EXPORT
(
int
,
net_ListenSingle
,
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
family
,
int
socktype
,
int
protocol
)
);
#define net_ListenTCP(a, b, c) __net_ListenTCP(VLC_OBJECT(a), b, c)
static
inline
int
*
__net_ListenTCP
(
vlc_object_t
*
obj
,
const
char
*
host
,
int
port
)
#define net_ConnectTCP(a, b, c) __net_ConnectTCP(VLC_OBJECT(a), b, c)
static
inline
int
*
__net_ListenTCP
(
vlc_object_t
*
obj
,
const
char
*
host
,
int
port
)
{
return
net_Listen
(
obj
,
host
,
port
,
AF_UNSPEC
,
SOCK_STREAM
,
IPPROTO_TCP
);
}
static
inline
int
__net_ConnectTCP
(
vlc_object_t
*
obj
,
const
char
*
host
,
int
port
)
{
return
__net_Connect
(
obj
,
host
,
port
,
SOCK_STREAM
,
IPPROTO_TCP
);
}
#define net_Accept(a, b, c) __net_Accept(VLC_OBJECT(a), b, c)
VLC_EXPORT
(
int
,
__net_Accept
,
(
vlc_object_t
*
,
int
*
,
mtime_t
)
);
...
...
src/network/tcp.c
View file @
d9906f43
...
...
@@ -61,11 +61,13 @@ extern int net_Socket( vlc_object_t *p_this, int i_family, int i_socktype,
int
i_protocol
);
/*****************************************************************************
* __net_Connect
TCP
:
* __net_Connect:
*****************************************************************************
* Open a TCP connection and return a handle
* Open a network connection.
* @return socket handler or -1 on error.
*****************************************************************************/
int
__net_ConnectTCP
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
)
int
__net_Connect
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
type
,
int
proto
)
{
struct
addrinfo
hints
,
*
res
,
*
ptr
;
const
char
*
psz_realhost
;
...
...
@@ -113,8 +115,8 @@ int __net_ConnectTCP( vlc_object_t *p_this, const char *psz_host, int i_port )
for
(
ptr
=
res
;
ptr
!=
NULL
;
ptr
=
ptr
->
ai_next
)
{
int
fd
=
net_Socket
(
p_this
,
ptr
->
ai_family
,
ptr
->
ai_socktype
,
ptr
->
ai_protocol
);
int
fd
=
net_Socket
(
p_this
,
ptr
->
ai_family
,
type
?:
ptr
->
ai_socktype
,
p
roto
?:
p
tr
->
ai_protocol
);
if
(
fd
==
-
1
)
{
if
(
u_errstep
<=
0
)
...
...
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