353 |
/* Return a string representation of a winsock error. */ |
/* Return a string representation of a winsock error. */ |
354 |
const char* |
const char* |
355 |
wsock_strerror (void) |
wsock_strerror (void) |
356 |
{ |
{ |
|
static char buf[384]; |
|
357 |
int ec = WSAGetLastError (); |
int ec = WSAGetLastError (); |
358 |
|
|
359 |
|
if (!ec) |
360 |
|
return ""; |
361 |
switch (ec) { |
switch (ec) { |
362 |
case WSAENETDOWN: |
case WSAENETDOWN: |
363 |
return _("The network subsystem has failed"); |
return _("Network unreachable"); |
364 |
|
|
365 |
|
case WSAEHOSTUNREACH: |
366 |
|
return _("Host unreachable"); |
367 |
|
|
368 |
case WSAHOST_NOT_FOUND: |
case WSAHOST_NOT_FOUND: |
369 |
return _("Authoritative Answer Host not found"); |
return _("Could not resolve host name"); |
370 |
|
|
371 |
|
case WSAECONNREFUSED: |
372 |
|
return _("Connection refused"); |
373 |
|
|
374 |
case WSAETIMEDOUT: |
case WSAETIMEDOUT: |
375 |
return _("The connection has been dropped because of a network failure"); |
case WSAECONNABORTED: |
376 |
|
return _("Connection timeout"); |
377 |
|
|
378 |
|
case WSAENETRESET: |
379 |
|
case WSAECONNRESET: |
380 |
|
return _("Connection resetted by peer"); |
381 |
|
|
382 |
|
case WSAESHUTDOWN: |
383 |
|
return _("Socket has been shutdown"); |
384 |
|
|
385 |
default: |
default: |
386 |
_snprintf (buf, sizeof (buf) -1, _("Unknown Winsock error ec=%d"),ec); |
break; |
|
return buf; |
|
387 |
} |
} |
388 |
return NULL; |
|
389 |
|
return ""; |
390 |
} |
} |
391 |
|
|
392 |
|
|