1 /*****************************************************************************
2 * error.c: Network error handling
3 *****************************************************************************
4 * Copyright (C) 2006 Rémi Denis-Courmont
7 * Author : Rémi Denis-Courmont <rem # videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
31 #if defined (WIN32) || defined (UNDER_CE)
32 const char *net_strerror( int value )
34 /* There doesn't seem to be any portable error message generation for
35 * Winsock errors. Some old versions had s_error, but it appears to be
36 * gone, and is not documented.
41 /* Feel free to add any error message as you see fit */
43 return "Destination unreachable";
46 return "Connection timed out";
49 return "Connection refused";
53 static char errmsg[14 + 5 + 1];
54 /* Given PE don't support thread-local storage, this cannot be
55 * implemented in a thread-safe manner, I'm afraid. */
57 if( ((unsigned)value) > 99999 ) /* avoid overflow */
58 return "Invalid error code";
60 sprintf( errmsg, "Winsock error %u", (unsigned)value );
65 return strerror( value );