diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2002-11-09 12:46:27 +0300 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2002-11-09 12:46:27 +0300 |
commit | b224c2482e7f66ce6c1ba038161d9384752cb95b (patch) | |
tree | a27bb5e3f535e6e0a2dd1e76e0be5f47a3ce531e /mcs/class/System/System.Net.Sockets | |
parent | 6c1761430e1c546bfec09892639013c59c105fe6 (diff) |
2002-11-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Socket.cs: offset == size == 0 it's ok in Send ().
svn path=/trunk/mcs/; revision=8896
Diffstat (limited to 'mcs/class/System/System.Net.Sockets')
-rw-r--r-- | mcs/class/System/System.Net.Sockets/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/System/System.Net.Sockets/Socket.cs | 35 |
2 files changed, 22 insertions, 17 deletions
diff --git a/mcs/class/System/System.Net.Sockets/ChangeLog b/mcs/class/System/System.Net.Sockets/ChangeLog index a67abc03f6a..967ff252f3f 100644 --- a/mcs/class/System/System.Net.Sockets/ChangeLog +++ b/mcs/class/System/System.Net.Sockets/ChangeLog @@ -1,3 +1,7 @@ +2002-11-09 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Socket.cs: offset == size == 0 it's ok in Send (). + 2002-11-03 Phillip Pearson <pp@myelin.co.nz> * TcpClient.cs: Fixed SetTcpClient() to pass through to the Client diff --git a/mcs/class/System/System.Net.Sockets/Socket.cs b/mcs/class/System/System.Net.Sockets/Socket.cs index a9ebb84021e..08478caade1 100644 --- a/mcs/class/System/System.Net.Sockets/Socket.cs +++ b/mcs/class/System/System.Net.Sockets/Socket.cs @@ -812,30 +812,31 @@ namespace System.Net.Sockets int count, SocketFlags flags); - public int Send(byte[] buf, int offset, int size, - SocketFlags flags) { - if(buf==null) { - throw new ArgumentNullException("buffer is null"); - } - if(offset<0 || offset>=buf.Length) { - throw new ArgumentOutOfRangeException("offset exceeds the size of buffer"); - } - if(offset+size<0 || offset+size>buf.Length) { - throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer"); - } + public int Send (byte[] buf, int offset, int size, SocketFlags flags) + { + if (buf == null) + throw new ArgumentNullException ("buffer"); + + if (offset < 0 || offset > buf.Length) + throw new ArgumentOutOfRangeException ("offset"); + + if (size < 0 || offset + size > buf.Length) + throw new ArgumentOutOfRangeException ("size"); + + if (size == 0) + return 0; int ret; try { - ret=Send_internal(socket, buf, offset, size, - flags); - } catch(SocketException) { - connected=false; + ret = Send_internal (socket, buf, offset, size, flags); + } catch (SocketException) { + connected = false; throw; } - connected=true; + connected = true; - return(ret); + return ret; } public int SendTo(byte[] buffer, EndPoint remote_end) { |