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
768327ad
Commit
768327ad
authored
Mar 09, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Common socket error handling
parent
341c52d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
0 deletions
+72
-0
include/network.h
include/network.h
+4
-0
src/Makefile.am
src/Makefile.am
+1
-0
src/network/net_error.c
src/network/net_error.c
+67
-0
No files found.
include/network.h
View file @
768327ad
...
@@ -38,6 +38,8 @@
...
@@ -38,6 +38,8 @@
# include <winsock2.h>
# include <winsock2.h>
# include <ws2tcpip.h>
# include <ws2tcpip.h>
# define ENETUNREACH WSAENETUNREACH
# define ENETUNREACH WSAENETUNREACH
# define net_errno (WSAGetLastError())
extern
const
char
*
net_strerror
(
int
val
);
#else
#else
# if HAVE_SYS_SOCKET_H
# if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
# include <sys/socket.h>
...
@@ -51,6 +53,8 @@
...
@@ -51,6 +53,8 @@
# include <net/netdb.h>
# include <net/netdb.h>
# endif
# endif
# include <netdb.h>
# include <netdb.h>
# define net_errno errno
# define net_strerror strerror
#endif
#endif
# ifdef __cplusplus
# ifdef __cplusplus
...
...
src/Makefile.am
View file @
768327ad
...
@@ -305,6 +305,7 @@ SOURCES_libvlc_common = \
...
@@ -305,6 +305,7 @@ SOURCES_libvlc_common = \
network/acl.c
\
network/acl.c
\
network/getaddrinfo.c
\
network/getaddrinfo.c
\
network/io.c
\
network/io.c
\
network/net_error.c
\
network/tcp.c
\
network/tcp.c
\
network/udp.c
\
network/udp.c
\
network/httpd.c
\
network/httpd.c
\
...
...
src/network/net_error.c
0 → 100644
View file @
768327ad
/*****************************************************************************
* net_error.c: Network error handling
*****************************************************************************
* Copyright (C) 2006 Rémi Denis-Courmont
* $Id$
*
* Author : Rémi Denis-Courmont <rem # videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
#include <errno.h>
#include "network.h"
#if defined (WIN32) || defined (UNDER_CE)
const
char
*
net_strerror
(
int
value
)
{
/* There doesn't seem to be any portable error message generation for
* Winsock errors. Some old versions had s_error, but it appears to be
* gone, and is not documented.
*/
switch
(
value
)
{
/* Feel free to add any error message as you see fit */
case
WSAENETUNREACH
:
return
"Destination unreachable"
;
case
WSAETIMEDOUT
:
return
"Connection timed out"
;
case
WSAECONNREFUSED
:
return
"Connection refused"
;
default:
{
static
char
errmsg
[
14
+
5
+
1
];
/* Given PE don't support thread-local storage, this cannot be
* implemented in a thread-safe manner, I'm afraid. */
if
(
((
unsigned
)
value
)
>
99999
)
/* avoid overflow */
return
"Invalid error code"
;
sprintf
(
errmsg
,
"Winsock error %u"
,
(
unsigned
)
value
);
return
errmsg
;
}
}
return
strerror
(
value
);
}
#endif
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