// http://www.myelin.co.nz
// (c) 2004-2011 Novell, Inc. (http://www.novell.com)
//
-
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
private bool useoverlappedIO;
private const int SOCKET_CLOSED = 10004;
+ private static readonly string timeout_exc_msg = "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond";
+
static void AddSockets (List<Socket> sockets, IList list, string name)
{
if (list != null) {
public int Receive (byte [] buffer)
{
- if (disposed && closed)
- throw new ObjectDisposedException (GetType ().ToString ());
-
- if (buffer == null)
- throw new ArgumentNullException ("buffer");
-
- SocketError error;
-
- int ret = Receive_nochecks (buffer, 0, buffer.Length, SocketFlags.None, out error);
-
- if (error != SocketError.Success)
- throw new SocketException ((int) error);
-
- return ret;
+ return Receive (buffer, SocketFlags.None);
}
public int Receive (byte [] buffer, SocketFlags flags)
if (error != SocketError.Success) {
if (error == SocketError.WouldBlock && blocking) // This might happen when ReceiveTimeout is set
- throw new SocketException ((int) error, "Operation timed out.");
+ throw new SocketException ((int) error, timeout_exc_msg);
throw new SocketException ((int) error);
}
if (error != SocketError.Success) {
if (error == SocketError.WouldBlock && blocking) // This might happen when ReceiveTimeout is set
- throw new SocketException ((int) error, "Operation timed out.");
+ throw new SocketException ((int) error, timeout_exc_msg);
throw new SocketException ((int) error);
}
if (error != SocketError.Success) {
if (error == SocketError.WouldBlock && blocking) // This might happen when ReceiveTimeout is set
- throw new SocketException ((int) error, "Operation timed out.");
+ throw new SocketException ((int) error, timeout_exc_msg);
throw new SocketException ((int) error);
}
connected = false;
else if (err == SocketError.WouldBlock && blocking) { // This might happen when ReceiveTimeout is set
if (throwOnError)
- throw new SocketException ((int) SocketError.TimedOut, "Operation timed out");
+ throw new SocketException ((int) SocketError.TimedOut, timeout_exc_msg);
error = (int) SocketError.TimedOut;
return 0;
}
if (fd == -1 && domain == AF_INET && type == SOCK_RAW &&
protocol == 0) {
/* Retry with protocol == 4 (see bug #54565) */
+ // https://bugzilla.novell.com/show_bug.cgi?id=MONO54565
socket_handle.protocol = 4;
fd = socket (AF_INET, SOCK_RAW, 4);
}
/* .net seems to set this by default for SOCK_STREAM, not for
* SOCK_DGRAM (see bug #36322)
+ * https://bugzilla.novell.com/show_bug.cgi?id=MONO36322
*
* It seems winsock has a rather different idea of what
* SO_REUSEADDR means. If it's set, then a new socket can be
* behaves as though any other system would when SO_REUSEADDR
* is true, so we don't need to do anything else here. See
* bug 53992.
+ * https://bugzilla.novell.com/show_bug.cgi?id=MONO53992
*/
{
int ret, true = 1;