Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
// AddressFamily.cs
//
// This code was automatically generated from
// ECMA CLI XML Library Specification.
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
// Created: Wed, 5 Sep 2001 06:31:59 UTC
// Source file: AllTypes.xml
// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.Sockets {
#if ONLY_1_1
[Serializable]
#endif
public enum AddressFamily {
Unknown = -1,
Unspecified = 0,
Unix = 1,
InterNetwork = 2,
ImpLink = 3,
Pup = 4,
Chaos = 5,
NS = 6,
Ipx = 6,
Iso = 7,
Osi = 7,
Ecma = 8,
DataKit = 9,
Ccitt = 10,
Sna = 11,
DecNet = 12,
DataLink = 13,
Lat = 14,
HyperChannel = 15,
AppleTalk = 16,
NetBios = 17,
VoiceView = 18,
FireFox = 19,
Banyan = 21,
Atm = 22,
InterNetworkV6 = 23,
Cluster = 24,
Ieee12844 = 25,
Irda = 26,
NetworkDesigners = 28,
Max = 29,
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
//
// System.Net.Sockets.IOControlCode.cs
//
// Author:
// Dick Porter (dick@ximian.com)
//
// (C) Copyright 2006 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
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.Sockets
{
public enum IOControlCode: long
{
AbsorbRouterAlert = 0x98000005,
AddMulticastGroupOnInterface = 0x9800000A,
AddressListChange = 0x28000017,
AddressListQuery = 0x48000016,
AddressListSort = 0xC8000019,
AssociateHandle = 0x88000001,
AsyncIO = 0x8004667D,
BindToInterface = 0x98000008,
DataToRead = 0x4004667F,
DeleteMulticastGroupFromInterface = 0x9800000B,
EnableCircularQueuing = 0x28000002,
Flush = 0x28000004,
GetBroadcastAddress = 0x48000005,
GetExtensionFunctionPointer = 0xC8000006,
GetGroupQos = 0xC8000008,
GetQos = 0xC8000007,
KeepAliveValues = 0x98000004,
LimitBroadcasts = 0x98000007,
MulticastInterface = 0x98000009,
MulticastScope = 0x8800000A,
MultipointLoopback = 0x88000009,
NamespaceChange = 0x88000019,
NonBlockingIO = 0x8004667E,
OobDataRead = 0x40047307,
QueryTargetPnpHandle = 0x48000018,
ReceiveAll = 0x98000001,
ReceiveAllIgmpMulticast = 0x98000003,
ReceiveAllMulticast = 0x98000002,
RoutingInterfaceChange = 0x88000015,
RoutingInterfaceQuery = 0xC8000014,
SetGroupQos = 0x8800000C,
SetQos = 0x8800000B,
TranslateHandle = 0xC800000D,
UnicastInterface = 0x98000006,
}
}

View File

@@ -0,0 +1,95 @@
//
// System.Net.Sockets.IPPacketInformation.cs
//
// Author:
// Dick Porter (dick@ximian.com)
//
// Copyright (C) 2007 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
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Net;
namespace System.Net.Sockets
{
public struct IPPacketInformation
{
IPAddress address;
int iface;
internal IPPacketInformation (IPAddress address, int iface)
{
this.address = address;
this.iface = iface;
}
public IPAddress Address
{
get {
return(address);
}
}
public int Interface
{
get {
return(iface);
}
}
public override bool Equals (object comparand)
{
if (!(comparand is IPPacketInformation)) {
return(false);
}
IPPacketInformation packet = (IPPacketInformation)comparand;
if (packet.iface != iface) {
return(false);
}
return(packet.address.Equals (address));
}
public override int GetHashCode ()
{
/* FIXME: see if we can work out the MS algorithm */
return(address.GetHashCode () + iface);
}
public static bool operator== (IPPacketInformation p1,
IPPacketInformation p2)
{
return(p1.Equals (p2));
}
public static bool operator!= (IPPacketInformation p1,
IPPacketInformation p2)
{
return(!p1.Equals (p2));
}
}
}

View File

@@ -0,0 +1,82 @@
//
// System.Net.Sockets.MulticastOption.cs
//
// Author:
// Andrew Sutton
//
// (C) Andrew Sutton
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Net;
namespace System.Net.Sockets
{
// <remarks>
// Encapsulates a multicast option
// </remarks>
public class IPv6MulticastOption
{
// Don't change the names of these fields without also
// changing socket-io.c in the runtime
private IPAddress group;
private long ifIndex;
public IPv6MulticastOption (IPAddress group)
: this (group, 0)
{
}
public IPv6MulticastOption (IPAddress group, long ifindex)
{
if (group == null)
throw new ArgumentNullException ("group");
if (ifindex < 0 || ifindex > 0xffffffff)
throw new ArgumentOutOfRangeException ("ifindex");
this.group = group;
this.ifIndex = ifindex;
}
public IPAddress Group
{
get { return group; }
set {
if (value == null)
throw new ArgumentNullException ("value");
group = value;
}
}
public long InterfaceIndex
{
get { return ifIndex; }
set {
if (value < 0 || value > 0xffffffff)
throw new ArgumentOutOfRangeException ("value");
ifIndex = value;
}
}
}
}

View File

@@ -0,0 +1,63 @@
//
// System.Net.Sockets.LingerOption.cs
//
// Author:
// Andrew Sutton
//
// (C) Andrew Sutton
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Net.Sockets
{
// <remarks>
// Encapsulates a linger option.
// </remarks>
public class LingerOption
{
// Don't change the names of these fields without also
// changing socket-io.c in the runtime
private bool enabled;
private int seconds;
public LingerOption (bool enable, int seconds)
{
enabled = enable;
this.seconds = seconds;
}
public bool Enabled
{
get { return enabled; }
set { enabled = value; }
}
public int LingerTime
{
get { return seconds; }
set { seconds = value; }
}
}
}

View File

@@ -0,0 +1,98 @@
//
// System.Net.Sockets.MulticastOption.cs
//
// Author:
// Andrew Sutton
//
// (C) Andrew Sutton
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Net;
namespace System.Net.Sockets
{
// <remarks>
// Encapsulates a multicast option
// </remarks>
public class MulticastOption
{
// Don't change the names of these fields without also
// changing socket-io.c in the runtime
private IPAddress group;
private IPAddress local;
int iface_index;
public MulticastOption (IPAddress group)
: this (group, IPAddress.Any)
{
}
public MulticastOption (IPAddress group, int interfaceIndex)
{
if (group == null)
throw new ArgumentNullException ("group");
if (interfaceIndex < 0 || interfaceIndex > 0xffffff)
throw new ArgumentOutOfRangeException ("interfaceIndex");
this.group = group;
this.iface_index = interfaceIndex;
}
public MulticastOption (IPAddress group, IPAddress mcint)
{
if (group == null)
throw new ArgumentNullException ("group");
if (mcint == null)
throw new ArgumentNullException ("mcint");
this.group = group;
this.local = mcint;
}
public IPAddress Group {
get { return group; }
set { group = value; }
}
public IPAddress LocalAddress {
get { return local; }
set {
local = value;
iface_index = 0;
}
}
public int InterfaceIndex {
get { return iface_index; }
set {
if (value < 0 || value > 0xffffff)
throw new ArgumentOutOfRangeException ("value");
iface_index = value;
local = null;
}
}
}
}

View File

@@ -0,0 +1,442 @@
//
// System.Net.Sockets.NetworkStream.cs
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
// Sridhar Kulkarni <sridharkulkarni@gmail.com>
//
// (C) 2002 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2002-2006 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
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.IO;
using System.Runtime.InteropServices;
#if !NET_2_1 || MOBILE
using System.Timers;
using System.Threading;
#endif
namespace System.Net.Sockets
{
public class NetworkStream : Stream, IDisposable {
FileAccess access;
Socket socket;
bool owns_socket;
bool readable, writeable;
bool disposed = false;
public NetworkStream (Socket socket)
: this (socket, FileAccess.ReadWrite, false)
{
}
public NetworkStream (Socket socket, bool ownsSocket)
: this (socket, FileAccess.ReadWrite, ownsSocket)
{
}
public NetworkStream (Socket socket, FileAccess access)
: this (socket, access, false)
{
}
public NetworkStream (Socket socket, FileAccess access, bool ownsSocket)
{
if (socket == null)
throw new ArgumentNullException ("socket is null");
if (socket.SocketType != SocketType.Stream)
throw new ArgumentException ("Socket is not of type Stream", "socket");
if (!socket.Connected)
throw new IOException ("Not connected");
if (!socket.Blocking)
throw new IOException ("Operation not allowed on a non-blocking socket.");
this.socket = socket;
this.owns_socket = ownsSocket;
this.access = access;
readable = CanRead;
writeable = CanWrite;
}
public override bool CanRead {
get {
return access == FileAccess.ReadWrite || access == FileAccess.Read;
}
}
public override bool CanSeek {
get {
// network sockets cant seek.
return false;
}
}
public override bool CanTimeout
{
get {
return(true);
}
}
public override bool CanWrite {
get {
return access == FileAccess.ReadWrite || access == FileAccess.Write;
}
}
public virtual bool DataAvailable {
get {
CheckDisposed ();
return socket.Available > 0;
}
}
public override long Length {
get {
// Network sockets always throw an exception
throw new NotSupportedException ();
}
}
public override long Position {
get {
// Network sockets always throw an exception
throw new NotSupportedException ();
}
set {
// Network sockets always throw an exception
throw new NotSupportedException ();
}
}
protected bool Readable {
get {
return readable;
}
set {
readable = value;
}
}
#if !NET_2_1 || MOBILE
#if TARGET_JVM
[MonoNotSupported ("Not supported since Socket.ReceiveTimeout is not supported")]
#endif
public override int ReadTimeout
{
get {
int r = socket.ReceiveTimeout;
return (r <= 0) ? Timeout.Infinite : r;
}
set {
if (value <= 0 && value != Timeout.Infinite) {
throw new ArgumentOutOfRangeException ("value", "The value specified is less than or equal to zero and is not Infinite.");
}
socket.ReceiveTimeout = value;
}
}
#endif
protected Socket Socket {
get {
return socket;
}
}
protected bool Writeable {
get {
return writeable;
}
set {
writeable = value;
}
}
#if !NET_2_1 || MOBILE
#if TARGET_JVM
[MonoNotSupported ("Not supported since Socket.SendTimeout is not supported")]
#endif
public override int WriteTimeout
{
get {
int r = socket.SendTimeout;
return (r <= 0) ? Timeout.Infinite : r;
}
set {
if (value <= 0 && value != Timeout.Infinite) {
throw new ArgumentOutOfRangeException ("value", "The value specified is less than or equal to zero and is not Infinite");
}
socket.SendTimeout = value;
}
}
#endif
public override IAsyncResult BeginRead (byte [] buffer, int offset, int size,
AsyncCallback callback, object state)
{
CheckDisposed ();
IAsyncResult retval;
if (buffer == null)
throw new ArgumentNullException ("buffer is null");
int len = buffer.Length;
if(offset<0 || offset>len) {
throw new ArgumentOutOfRangeException("offset exceeds the size of buffer");
}
if(size<0 || offset+size>len) {
throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
}
Socket s = socket;
if (s == null) {
throw new IOException("Connection closed");
}
try {
retval = s.BeginReceive (buffer, offset, size, 0, callback, state);
} catch (Exception e) {
throw new IOException ("BeginReceive failure", e);
}
return retval;
}
public override IAsyncResult BeginWrite (byte [] buffer, int offset, int size,
AsyncCallback callback, object state)
{
CheckDisposed ();
IAsyncResult retval;
if (buffer == null)
throw new ArgumentNullException ("buffer is null");
int len = buffer.Length;
if(offset<0 || offset>len) {
throw new ArgumentOutOfRangeException("offset exceeds the size of buffer");
}
if(size<0 || offset+size>len) {
throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
}
Socket s = socket;
if (s == null) {
throw new IOException("Connection closed");
}
try {
retval = s.BeginSend (buffer, offset, size, 0, callback, state);
} catch (Exception e) {
throw new IOException ("BeginWrite failure", e);
}
return retval;
}
~NetworkStream ()
{
Dispose (false);
}
#if !NET_2_1 || MOBILE
public void Close (int timeout)
{
if (timeout < -1) {
throw new ArgumentOutOfRangeException ("timeout", "timeout is less than -1");
}
System.Timers.Timer close_timer = new System.Timers.Timer ();
close_timer.Elapsed += new ElapsedEventHandler (OnTimeoutClose);
/* NB timeout is in milliseconds here, cf
* seconds in Socket.Close(int)
*/
close_timer.Interval = timeout;
close_timer.AutoReset = false;
close_timer.Enabled = true;
}
private void OnTimeoutClose (object source, ElapsedEventArgs e)
{
this.Close ();
}
#endif
protected override void Dispose (bool disposing)
{
if (disposed)
return;
disposed = true;
if (owns_socket) {
Socket s = socket;
if (s != null)
s.Close ();
}
socket = null;
access = 0;
if (disposing)
GC.SuppressFinalize (this);
}
public override int EndRead (IAsyncResult ar)
{
CheckDisposed ();
int res;
if (ar == null)
throw new ArgumentNullException ("async result is null");
Socket s = socket;
if (s == null) {
throw new IOException("Connection closed");
}
try {
res = s.EndReceive (ar);
} catch (Exception e) {
throw new IOException ("EndRead failure", e);
}
return res;
}
public override void EndWrite (IAsyncResult ar)
{
CheckDisposed ();
if (ar == null)
throw new ArgumentNullException ("async result is null");
Socket s = socket;
if (s == null) {
throw new IOException("Connection closed");
}
try {
s.EndSend (ar);
} catch (Exception e) {
throw new IOException ("EndWrite failure", e);
}
}
public override void Flush ()
{
// network streams are non-buffered, this is a no-op
}
public override int Read ([In,Out] byte [] buffer, int offset, int size)
{
CheckDisposed ();
int res;
if (buffer == null)
throw new ArgumentNullException ("buffer is null");
if(offset<0 || offset>buffer.Length) {
throw new ArgumentOutOfRangeException("offset exceeds the size of buffer");
}
if(size < 0 || offset+size>buffer.Length) {
throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
}
Socket s = socket;
if (s == null) {
throw new IOException("Connection closed");
}
try {
res = s.Receive (buffer, offset, size, 0);
} catch (Exception e) {
throw new IOException ("Read failure", e);
}
return res;
}
public override long Seek (long offset, SeekOrigin origin)
{
// NetworkStream objects do not support seeking.
throw new NotSupportedException ();
}
public override void SetLength (long value)
{
// NetworkStream objects do not support SetLength
throw new NotSupportedException ();
}
public override void Write (byte [] buffer, int offset, int size)
{
CheckDisposed ();
if (buffer == null)
throw new ArgumentNullException ("buffer");
if (offset < 0 || offset > buffer.Length)
throw new ArgumentOutOfRangeException("offset exceeds the size of buffer");
if (size < 0 || size > buffer.Length - offset)
throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
Socket s = socket;
if (s == null) {
throw new IOException("Connection closed");
}
try {
int count = 0;
while (size - count > 0) {
count += s.Send (buffer, offset + count, size - count, 0);
}
} catch (Exception e) {
throw new IOException ("Write failure", e);
}
}
private void CheckDisposed ()
{
if (disposed)
throw new ObjectDisposedException (GetType().FullName);
}
#if TARGET_JVM
public void ChangeToSSLSocket()
{
socket.ChangeToSSL();
}
#endif
}
}

View File

@@ -0,0 +1,68 @@
//
// System.Net.Sockets.ProtocolFamily.cs
//
// Author:
// Andrew Sutton
//
// (C) Andrew Sutton
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.Sockets
{
public enum ProtocolFamily
{
Unknown = -1,
Unspecified = 0,
Unix,
InterNetwork,
ImpLink,
Pup,
Chaos,
Ipx,
Iso,
Ecma,
DataKit,
Ccitt,
Sna,
DecNet,
DataLink,
Lat,
HyperChannel,
AppleTalk,
NetBios,
VoiceView,
FireFox,
Banyan = 0x15,
Atm,
InterNetworkV6,
Cluster,
Ieee12844,
Irda,
NetworkDesigners = 0x1c,
Max,
NS = Ipx,
Osi = Iso,
}
}

View File

@@ -0,0 +1,116 @@
// ProtocolType.cs
//
// This code was automatically generated from
// ECMA CLI XML Library Specification.
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
// Created: Wed, 5 Sep 2001 06:32:24 UTC
// Source file: AllTypes.xml
// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.Sockets {
/// <summary>
/// </summary>
public enum ProtocolType {
/// <summary>
/// </summary>
IP = 0,
/// <summary>
/// </summary>
Icmp = 1,
/// <summary>
/// </summary>
Igmp = 2,
/// <summary>
/// </summary>
Ggp = 3,
/// <summary>
/// </summary>
Tcp = 6,
/// <summary>
/// </summary>
Pup = 12,
/// <summary>
/// </summary>
Udp = 17,
/// <summary>
/// </summary>
Idp = 22,
/// <summary>
/// </summary>
IPv6 = 41,
/// <summary>
/// </summary>
ND = 77,
/// <summary>
/// </summary>
Raw = 255,
/// <summary>
/// </summary>
Unspecified = 0,
/// <summary>
/// </summary>
Ipx = 1000,
/// <summary>
/// </summary>
Spx = 1256,
/// <summary>
/// </summary>
SpxII = 1257,
/// <summary>
/// </summary>
Unknown = -1,
IPv4 = 4,
IPv6RoutingHeader = 43,
IPv6FragmentHeader = 44,
IPSecEncapsulatingSecurityPayload = 50,
IPSecAuthenticationHeader = 51,
IcmpV6 = 58,
IPv6NoNextHeader = 59,
IPv6DestinationOptions = 60,
IPv6HopByHopOptions = 0,
} // ProtocolType
} // System.Net.Sockets

View File

@@ -0,0 +1,54 @@
// SelectMode.cs
//
// This code was automatically generated from
// ECMA CLI XML Library Specification.
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
// Created: Wed, 5 Sep 2001 06:32:30 UTC
// Source file: AllTypes.xml
// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.Sockets {
/// <summary>
/// </summary>
public enum SelectMode {
/// <summary>
/// </summary>
SelectRead = 0,
/// <summary>
/// </summary>
SelectWrite = 1,
/// <summary>
/// </summary>
SelectError = 2,
} // SelectMode
} // System.Net.Sockets

View File

@@ -0,0 +1,89 @@
// System.Net.Sockets.SocketAsyncEventArgs.cs
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// Copyright (c) 2008 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
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Net.Sockets
{
public class SendPacketsElement
{
public byte[] Buffer { get; private set; }
public int Count { get; private set; }
public bool EndOfPacket { get; private set; }
public string FilePath { get; private set; }
public int Offset { get; private set; }
public SendPacketsElement (byte[] buffer) : this (buffer, 0, buffer != null ? buffer.Length : 0)
{
}
public SendPacketsElement (byte[] buffer, int offset, int count) : this (buffer, offset, count, false)
{
}
public SendPacketsElement (byte[] buffer, int offset, int count, bool endOfPacket)
{
if (buffer == null)
throw new ArgumentNullException ("buffer");
int buflen = buffer.Length;
if (offset < 0 || offset >= buflen)
throw new ArgumentOutOfRangeException ("offset");
if (count < 0 || offset + count >= buflen)
throw new ArgumentOutOfRangeException ("count");
Buffer = buffer;
Offset = offset;
Count = count;
EndOfPacket = endOfPacket;
FilePath = null;
}
public SendPacketsElement (string filepath) : this (filepath, 0, 0, false)
{
}
public SendPacketsElement (string filepath, int offset, int count) : this (filepath, offset, count, false)
{
}
// LAME SPEC: only ArgumentNullException for filepath is thrown
public SendPacketsElement (string filepath, int offset, int count, bool endOfPacket)
{
if (filepath == null)
throw new ArgumentNullException ("filepath");
Buffer = null;
Offset = offset;
Count = count;
EndOfPacket = endOfPacket;
FilePath = filepath;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,334 @@
// System.Net.Sockets.SocketAsyncEventArgs.cs
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
// Gonzalo Paniagua Javier (gonzalo@xamarin.com)
//
// Copyright (c) 2008,2010 Novell, Inc. (http://www.novell.com)
// Copyright (c) 2011 Xamarin, Inc. (http://xamarin.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Security;
using System.Threading;
namespace System.Net.Sockets
{
public class SocketAsyncEventArgs : EventArgs, IDisposable
{
bool disposed;
int in_progress;
internal Socket.Worker Worker;
EndPoint remote_ep;
#if NET_4_0
public Exception ConnectByNameError { get; internal set; }
#endif
public event EventHandler<SocketAsyncEventArgs> Completed;
IList <ArraySegment <byte>> _bufferList;
public Socket AcceptSocket { get; set; }
public byte[] Buffer { get; private set; }
public IList<ArraySegment<byte>> BufferList {
get { return _bufferList; }
set {
if (Buffer != null && value != null)
throw new ArgumentException ("Buffer and BufferList properties cannot both be non-null.");
_bufferList = value;
}
}
public int BytesTransferred { get; internal set; }
public int Count { get; internal set; }
public bool DisconnectReuseSocket { get; set; }
public SocketAsyncOperation LastOperation { get; private set; }
public int Offset { get; private set; }
public EndPoint RemoteEndPoint {
get { return remote_ep; }
set { remote_ep = value; }
}
#if !NET_2_1
public IPPacketInformation ReceiveMessageFromPacketInfo { get; private set; }
public SendPacketsElement[] SendPacketsElements { get; set; }
public TransmitFileOptions SendPacketsFlags { get; set; }
#endif
[MonoTODO ("unused property")]
public int SendPacketsSendSize { get; set; }
public SocketError SocketError { get; set; }
public SocketFlags SocketFlags { get; set; }
public object UserToken { get; set; }
internal Socket curSocket;
#if (NET_2_1 || NET_4_0)
public Socket ConnectSocket {
get {
switch (SocketError) {
case SocketError.AccessDenied:
return null;
default:
return curSocket;
}
}
}
internal bool PolicyRestricted { get; private set; }
internal SocketAsyncEventArgs (bool policy) :
this ()
{
PolicyRestricted = policy;
}
#endif
public SocketAsyncEventArgs ()
{
Worker = new Socket.Worker (this);
AcceptSocket = null;
Buffer = null;
BufferList = null;
BytesTransferred = 0;
Count = 0;
DisconnectReuseSocket = false;
LastOperation = SocketAsyncOperation.None;
Offset = 0;
RemoteEndPoint = null;
#if !NET_2_1
SendPacketsElements = null;
SendPacketsFlags = TransmitFileOptions.UseDefaultWorkerThread;
#endif
SendPacketsSendSize = -1;
SocketError = SocketError.Success;
SocketFlags = SocketFlags.None;
UserToken = null;
}
~SocketAsyncEventArgs ()
{
Dispose (false);
}
void Dispose (bool disposing)
{
disposed = true;
if (disposing) {
if (disposed || Interlocked.CompareExchange (ref in_progress, 0, 0) != 0)
return;
if (Worker != null) {
Worker.Dispose ();
Worker = null;
}
}
AcceptSocket = null;
Buffer = null;
BufferList = null;
RemoteEndPoint = null;
UserToken = null;
#if !NET_2_1
SendPacketsElements = null;
#endif
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
internal void SetLastOperation (SocketAsyncOperation op)
{
if (disposed)
throw new ObjectDisposedException ("System.Net.Sockets.SocketAsyncEventArgs");
if (Interlocked.Exchange (ref in_progress, 1) != 0)
throw new InvalidOperationException ("Operation already in progress");
LastOperation = op;
}
protected virtual void OnCompleted (SocketAsyncEventArgs e)
{
if (e == null)
return;
EventHandler<SocketAsyncEventArgs> handler = e.Completed;
if (handler != null)
handler (e.curSocket, e);
}
public void SetBuffer (int offset, int count)
{
SetBufferInternal (Buffer, offset, count);
}
public void SetBuffer (byte[] buffer, int offset, int count)
{
SetBufferInternal (buffer, offset, count);
}
void SetBufferInternal (byte[] buffer, int offset, int count)
{
if (buffer != null) {
if (BufferList != null)
throw new ArgumentException ("Buffer and BufferList properties cannot both be non-null.");
int buflen = buffer.Length;
if (offset < 0 || (offset != 0 && offset >= buflen))
throw new ArgumentOutOfRangeException ("offset");
if (count < 0 || count > buflen - offset)
throw new ArgumentOutOfRangeException ("count");
Count = count;
Offset = offset;
}
Buffer = buffer;
}
#region Internals
internal static AsyncCallback Dispatcher = new AsyncCallback (DispatcherCB);
static void DispatcherCB (IAsyncResult ares)
{
SocketAsyncEventArgs args = (SocketAsyncEventArgs) ares.AsyncState;
if (Interlocked.Exchange (ref args.in_progress, 0) != 1)
throw new InvalidOperationException ("No operation in progress");
SocketAsyncOperation op = args.LastOperation;
// Notes;
// -SocketOperation.AcceptReceive not used in SocketAsyncEventArgs
// -SendPackets and ReceiveMessageFrom are not implemented yet
if (op == SocketAsyncOperation.Receive)
args.ReceiveCallback (ares);
else if (op == SocketAsyncOperation.Send)
args.SendCallback (ares);
else if (op == SocketAsyncOperation.ReceiveFrom)
args.ReceiveFromCallback (ares);
else if (op == SocketAsyncOperation.SendTo)
args.SendToCallback (ares);
else if (op == SocketAsyncOperation.Accept)
args.AcceptCallback (ares);
else if (op == SocketAsyncOperation.Disconnect)
args.DisconnectCallback (ares);
else if (op == SocketAsyncOperation.Connect)
args.ConnectCallback ();
/*
else if (op == Socket.SocketOperation.ReceiveMessageFrom)
else if (op == Socket.SocketOperation.SendPackets)
*/
else
throw new NotImplementedException (String.Format ("Operation {0} is not implemented", op));
}
internal void ReceiveCallback (IAsyncResult ares)
{
try {
BytesTransferred = curSocket.EndReceive (ares);
} catch (SocketException se){
SocketError = se.SocketErrorCode;
} catch (ObjectDisposedException) {
SocketError = SocketError.OperationAborted;
} finally {
OnCompleted (this);
}
}
void ConnectCallback ()
{
try {
SocketError = (SocketError) Worker.result.error;
} finally {
OnCompleted (this);
}
}
internal void SendCallback (IAsyncResult ares)
{
try {
BytesTransferred = curSocket.EndSend (ares);
} catch (SocketException se){
SocketError = se.SocketErrorCode;
} catch (ObjectDisposedException) {
SocketError = SocketError.OperationAborted;
} finally {
OnCompleted (this);
}
}
internal void AcceptCallback (IAsyncResult ares)
{
try {
AcceptSocket = curSocket.EndAccept (ares);
} catch (SocketException ex) {
SocketError = ex.SocketErrorCode;
} catch (ObjectDisposedException) {
SocketError = SocketError.OperationAborted;
} finally {
if (AcceptSocket == null)
AcceptSocket = new Socket (curSocket.AddressFamily, curSocket.SocketType, curSocket.ProtocolType, (IntPtr)(-1));
OnCompleted (this);
}
}
internal void DisconnectCallback (IAsyncResult ares)
{
try {
curSocket.EndDisconnect (ares);
} catch (SocketException ex) {
SocketError = ex.SocketErrorCode;
} catch (ObjectDisposedException) {
SocketError = SocketError.OperationAborted;
} finally {
OnCompleted (this);
}
}
internal void ReceiveFromCallback (IAsyncResult ares)
{
try {
BytesTransferred = curSocket.EndReceiveFrom (ares, ref remote_ep);
} catch (SocketException ex) {
SocketError = ex.SocketErrorCode;
} catch (ObjectDisposedException) {
SocketError = SocketError.OperationAborted;
} finally {
OnCompleted (this);
}
}
internal void SendToCallback (IAsyncResult ares)
{
try {
BytesTransferred = curSocket.EndSendTo (ares);
} catch (SocketException ex) {
SocketError = ex.SocketErrorCode;
} catch (ObjectDisposedException) {
SocketError = SocketError.OperationAborted;
} finally {
OnCompleted (this);
}
}
#endregion
}
}

View File

@@ -0,0 +1,44 @@
// System.Net.Sockets.SocketAsyncOperation.cs
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// Copyright (c) 2008 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
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.Sockets
{
public enum SocketAsyncOperation
{
None,
Accept,
Connect,
Disconnect,
Receive,
ReceiveFrom,
ReceiveMessageFrom,
Send,
SendPackets,
SendTo
}
}

View File

@@ -0,0 +1,83 @@
//
// System.Net.Sockets.SocketError.cs
//
// Author:
// Robert Jordan <robertj@gmx.net>
//
// Copyright (C) 2005 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
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.Sockets
{
public enum SocketError
{
AccessDenied = 10013,
AddressAlreadyInUse = 10048,
AddressFamilyNotSupported = 10047,
AddressNotAvailable = 10049,
AlreadyInProgress = 10037,
ConnectionAborted = 10053,
ConnectionRefused = 10061,
ConnectionReset = 10054,
DestinationAddressRequired = 10039,
Disconnecting = 10101,
Fault = 10014,
HostDown = 10064,
HostNotFound = 11001,
HostUnreachable = 10065,
InProgress = 10036,
Interrupted = 10004,
InvalidArgument = 10022,
IOPending = 997,
IsConnected = 10056,
MessageSize = 10040,
NetworkDown = 10050,
NetworkReset = 10052,
NetworkUnreachable = 10051,
NoBufferSpaceAvailable = 10055,
NoData = 11004,
NoRecovery = 11003,
NotConnected = 10057,
NotInitialized = 10093,
NotSocket = 10038,
OperationAborted = 995,
OperationNotSupported = 10045,
ProcessLimit = 10067,
ProtocolFamilyNotSupported = 10046,
ProtocolNotSupported = 10043,
ProtocolOption = 10042,
ProtocolType = 10041,
Shutdown = 10058,
SocketError = -1,
SocketNotSupported = 10044,
Success = 0,
SystemNotReady = 10091,
TimedOut = 10060,
TooManyOpenSockets = 10024,
TryAgain = 11002,
TypeNotFound = 10109,
VersionNotSupported = 10092,
WouldBlock = 10035
}
}

View File

@@ -0,0 +1,85 @@
//
// System.Net.Sockets.NetworkStream.cs
//
// Author:
// Dick Porter <dick@ximian.com>
//
// (C) 2002 Ximian, Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.Serialization;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace System.Net.Sockets
{
[Serializable]
public class SocketException : Win32Exception
{
#if TARGET_JVM
public SocketException ()
: base (-2147467259)
#else
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private static extern int WSAGetLastError_internal ();
public SocketException ()
: base (WSAGetLastError_internal ())
#endif
{
}
public SocketException (int error)
: base (error) {
}
protected SocketException (SerializationInfo info,
StreamingContext context)
: base (info, context) {
}
internal SocketException (int error, string message)
: base (error, message)
{
}
public override int ErrorCode {
get {
return NativeErrorCode;
}
}
public SocketError SocketErrorCode {
get {
return (SocketError) NativeErrorCode;
}
}
public override string Message {
get {
return base.Message;
}
}
}
}

View File

@@ -0,0 +1,49 @@
// SocketFlags.cs
//
// This code was automatically generated from
// ECMA CLI XML Library Specification.
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
// Created: Wed, 5 Sep 2001 06:32:49 UTC
// Source file: AllTypes.xml
// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.Sockets {
[Flags]
public enum SocketFlags {
None = 0x00000000,
OutOfBand = 0x00000001,
Peek = 0x00000002,
DontRoute = 0x00000004,
MaxIOVectorLength = 0x00000010,
Truncated = 0x00000100,
ControlDataTruncated = 0x00000200,
Broadcast = 0x00000400,
Multicast = 0x00000800,
Partial = 0x00008000,
} // SocketFlags
} // System.Net.Sockets

View File

@@ -0,0 +1,61 @@
//
// System.Net.Sockets.SocketInformation.cs
//
// Author:
// Dick Porter (dick@ximian.com)
//
// Copyright (C) 2006 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
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Net.Sockets
{
[Serializable]
public struct SocketInformation
{
SocketInformationOptions options;
byte[] protocol_info;
public SocketInformationOptions Options {
get {
return(options);
}
set {
options = value;
}
}
public byte[] ProtocolInformation {
get {
return(protocol_info);
}
set {
protocol_info = value;
}
}
}
}

View File

@@ -0,0 +1,43 @@
//
// System.Net.Sockets.SocketInformationOptions.cs
//
// Author:
// Sridhar Kulkarni (sridharkulkarni@gmail.com)
//
// (C) 2006 Sridhar Kulkarni
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Net.Sockets
{
[FlagsAttribute]
public enum SocketInformationOptions {
NonBlocking = 0x00000001,
Connected = 0x00000002,
Listening = 0x00000004,
UseOnlyOverlappedIO = 0x00000008
}
}

Some files were not shown because too many files have changed in this diff Show More