Files
2026-06-04 11:42:34 +02:00

5669 lines
313 KiB
C#
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Threading;
namespace System.Net.Sockets
{
/// <summary>Implements the Berkeley sockets interface.</summary>
// Token: 0x020001E4 RID: 484
public class Socket : IDisposable
{
// Token: 0x06000FA1 RID: 4001 RVA: 0x0002ACA0 File Offset: 0x00028EA0
private Socket(AddressFamily family, SocketType type, ProtocolType proto, IntPtr sock)
{
this.address_family = family;
this.socket_type = type;
this.protocol_type = proto;
this.socket = sock;
this.connected = true;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Sockets.Socket" /> class using the specified value returned from <see cref="M:System.Net.Sockets.Socket.DuplicateAndClose(System.Int32)" />.</summary>
/// <param name="socketInformation">The socket information returned by <see cref="M:System.Net.Sockets.Socket.DuplicateAndClose(System.Int32)" />.</param>
// Token: 0x06000FA2 RID: 4002 RVA: 0x0002AD14 File Offset: 0x00028F14
[global::System.MonoTODO]
public Socket(SocketInformation socketInformation)
{
throw new NotImplementedException("SocketInformation not figured out yet");
}
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Sockets.Socket" /> class using the specified address family, socket type and protocol.</summary>
/// <param name="addressFamily">One of the <see cref="T:System.Net.Sockets.AddressFamily" /> values. </param>
/// <param name="socketType">One of the <see cref="T:System.Net.Sockets.SocketType" /> values. </param>
/// <param name="protocolType">One of the <see cref="T:System.Net.Sockets.ProtocolType" /> values. </param>
/// <exception cref="T:System.Net.Sockets.SocketException">The combination of <paramref name="addressFamily" />, <paramref name="socketType" />, and <paramref name="protocolType" /> results in an invalid socket. </exception>
// Token: 0x06000FA3 RID: 4003 RVA: 0x0002AD70 File Offset: 0x00028F70
public Socket(AddressFamily family, SocketType type, ProtocolType proto)
{
if (family == AddressFamily.Unspecified)
{
throw new ArgumentException("family");
}
this.address_family = family;
this.socket_type = type;
this.protocol_type = proto;
int num;
this.socket = this.Socket_internal(family, type, proto, out num);
if (num != 0)
{
throw new SocketException(num);
}
}
// Token: 0x06000FA4 RID: 4004 RVA: 0x0002AE04 File Offset: 0x00029004
static Socket()
{
Socket.CheckProtocolSupport();
}
// Token: 0x06000FA5 RID: 4005 RVA: 0x0002AE18 File Offset: 0x00029018
private static void AddSockets(ArrayList sockets, IList list, string name)
{
if (list != null)
{
foreach (object obj in list)
{
Socket socket = (Socket)obj;
if (socket == null)
{
throw new ArgumentNullException("name", "Contains a null element");
}
sockets.Add(socket);
}
}
sockets.Add(null);
}
// Token: 0x06000FA6 RID: 4006
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Select_internal(ref Socket[] sockets, int microSeconds, out int error);
/// <summary>Determines the status of one or more sockets.</summary>
/// <param name="checkRead">An <see cref="T:System.Collections.IList" /> of <see cref="T:System.Net.Sockets.Socket" /> instances to check for readability. </param>
/// <param name="checkWrite">An <see cref="T:System.Collections.IList" /> of <see cref="T:System.Net.Sockets.Socket" /> instances to check for writability. </param>
/// <param name="checkError">An <see cref="T:System.Collections.IList" /> of <see cref="T:System.Net.Sockets.Socket" /> instances to check for errors. </param>
/// <param name="microSeconds">The time-out value, in microseconds. A -1 value indicates an infinite time-out.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="checkRead" /> parameter is null or empty.-and- The <paramref name="checkWrite" /> parameter is null or empty -and- The <paramref name="checkError" /> parameter is null or empty. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
// Token: 0x06000FA7 RID: 4007 RVA: 0x0002AEA8 File Offset: 0x000290A8
public static void Select(IList checkRead, IList checkWrite, IList checkError, int microSeconds)
{
ArrayList arrayList = new ArrayList();
Socket.AddSockets(arrayList, checkRead, "checkRead");
Socket.AddSockets(arrayList, checkWrite, "checkWrite");
Socket.AddSockets(arrayList, checkError, "checkError");
if (arrayList.Count == 3)
{
throw new ArgumentNullException("checkRead, checkWrite, checkError", "All the lists are null or empty.");
}
Socket[] array = (Socket[])arrayList.ToArray(typeof(Socket));
int num;
Socket.Select_internal(ref array, microSeconds, out num);
if (num != 0)
{
throw new SocketException(num);
}
if (array == null)
{
if (checkRead != null)
{
checkRead.Clear();
}
if (checkWrite != null)
{
checkWrite.Clear();
}
if (checkError != null)
{
checkError.Clear();
}
return;
}
int num2 = 0;
int num3 = array.Length;
IList list = checkRead;
int num4 = 0;
for (int i = 0; i < num3; i++)
{
Socket socket = array[i];
if (socket == null)
{
if (list != null)
{
int num5 = list.Count - num4;
for (int j = 0; j < num5; j++)
{
list.RemoveAt(num4);
}
}
list = ((num2 != 0) ? checkError : checkWrite);
num4 = 0;
num2++;
}
else
{
if (num2 == 1 && list == checkWrite && !socket.connected && (int)socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error) == 0)
{
socket.connected = true;
}
if (list != null && num4 < list.Count)
{
while ((Socket)list[num4] != socket)
{
list.RemoveAt(num4);
}
}
num4++;
}
}
}
// Token: 0x06000FA8 RID: 4008 RVA: 0x0002B058 File Offset: 0x00029258
private void SocketDefaults()
{
try
{
if (this.address_family == AddressFamily.InterNetwork)
{
this.DontFragment = false;
}
}
catch (SocketException)
{
}
}
// Token: 0x06000FA9 RID: 4009
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int Available_internal(IntPtr socket, out int error);
/// <summary>Gets the amount of data that has been received from the network and is available to be read.</summary>
/// <returns>The number of bytes of data received from the network and available to be read.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x17000558 RID: 1368
// (get) Token: 0x06000FAA RID: 4010 RVA: 0x0002B0A0 File Offset: 0x000292A0
public int Available
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
int num2;
int num = Socket.Available_internal(this.socket, out num2);
if (num2 != 0)
{
throw new SocketException(num2);
}
return num;
}
}
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that specifies whether the <see cref="T:System.Net.Sockets.Socket" /> allows Internet Protocol (IP) datagrams to be fragmented.</summary>
/// <returns>true if the <see cref="T:System.Net.Sockets.Socket" /> allows datagram fragmentation; otherwise, false. The default is true.</returns>
/// <exception cref="T:System.NotSupportedException">This property can be set only for sockets in the <see cref="F:System.Net.Sockets.AddressFamily.InterNetwork" /> or <see cref="F:System.Net.Sockets.AddressFamily.InterNetworkV6" /> families. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x17000559 RID: 1369
// (get) Token: 0x06000FAB RID: 4011 RVA: 0x0002B0F0 File Offset: 0x000292F0
// (set) Token: 0x06000FAC RID: 4012 RVA: 0x0002B180 File Offset: 0x00029380
public bool DontFragment
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
bool flag;
if (this.address_family == AddressFamily.InterNetwork)
{
flag = (int)this.GetSocketOption(SocketOptionLevel.IP, SocketOptionName.DontFragment) != 0;
}
else
{
if (this.address_family != AddressFamily.InterNetworkV6)
{
throw new NotSupportedException("This property is only valid for InterNetwork and InterNetworkV6 sockets");
}
flag = (int)this.GetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.DontFragment) != 0;
}
return flag;
}
set
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.address_family == AddressFamily.InterNetwork)
{
this.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.DontFragment, (!value) ? 0 : 1);
}
else
{
if (this.address_family != AddressFamily.InterNetworkV6)
{
throw new NotSupportedException("This property is only valid for InterNetwork and InterNetworkV6 sockets");
}
this.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.DontFragment, (!value) ? 0 : 1);
}
}
}
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that specifies whether the <see cref="T:System.Net.Sockets.Socket" /> can send or receive broadcast packets.</summary>
/// <returns>true if the <see cref="T:System.Net.Sockets.Socket" /> allows broadcast packets; otherwise, false. The default is false.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">This option is valid for a datagram socket only. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700055A RID: 1370
// (get) Token: 0x06000FAD RID: 4013 RVA: 0x0002B210 File Offset: 0x00029410
// (set) Token: 0x06000FAE RID: 4014 RVA: 0x0002B274 File Offset: 0x00029474
public bool EnableBroadcast
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.protocol_type != ProtocolType.Udp)
{
throw new SocketException(10042);
}
return (int)this.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast) != 0;
}
set
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.protocol_type != ProtocolType.Udp)
{
throw new SocketException(10042);
}
this.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, (!value) ? 0 : 1);
}
}
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that specifies whether the <see cref="T:System.Net.Sockets.Socket" /> allows only one process to bind to a port.</summary>
/// <returns>true if the <see cref="T:System.Net.Sockets.Socket" /> allows only one socket to bind to a specific port; otherwise, false. The default is true for Windows Server 2003 and Windows XP Service Pack 2, and false for all other versions.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.Bind(System.Net.EndPoint)" /> has been called for this <see cref="T:System.Net.Sockets.Socket" />.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700055B RID: 1371
// (get) Token: 0x06000FAF RID: 4015 RVA: 0x0002B2DC File Offset: 0x000294DC
// (set) Token: 0x06000FB0 RID: 4016 RVA: 0x0002B328 File Offset: 0x00029528
public bool ExclusiveAddressUse
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
return (int)this.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse) != 0;
}
set
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.isbound)
{
throw new InvalidOperationException("Bind has already been called for this socket");
}
this.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, (!value) ? 0 : 1);
}
}
/// <summary>Gets a value that indicates whether the <see cref="T:System.Net.Sockets.Socket" /> is bound to a specific local port.</summary>
/// <returns>true if the <see cref="T:System.Net.Sockets.Socket" /> is bound to a local port; otherwise, false.</returns>
// Token: 0x1700055C RID: 1372
// (get) Token: 0x06000FB1 RID: 4017 RVA: 0x0002B38C File Offset: 0x0002958C
public bool IsBound
{
get
{
return this.isbound;
}
}
/// <summary>Gets or sets a value that specifies whether the <see cref="T:System.Net.Sockets.Socket" /> will delay closing a socket in an attempt to send all pending data.</summary>
/// <returns>A <see cref="T:System.Net.Sockets.LingerOption" /> that specifies how to linger while closing a socket.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700055D RID: 1373
// (get) Token: 0x06000FB2 RID: 4018 RVA: 0x0002B394 File Offset: 0x00029594
// (set) Token: 0x06000FB3 RID: 4019 RVA: 0x0002B3E0 File Offset: 0x000295E0
public LingerOption LingerState
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
return (LingerOption)this.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger);
}
set
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
this.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, value);
}
}
/// <summary>Gets or sets a value that specifies whether outgoing multicast packets are delivered to the sending application.</summary>
/// <returns>true if the <see cref="T:System.Net.Sockets.Socket" /> receives outgoing multicast packets; otherwise, false.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700055E RID: 1374
// (get) Token: 0x06000FB4 RID: 4020 RVA: 0x0002B428 File Offset: 0x00029628
// (set) Token: 0x06000FB5 RID: 4021 RVA: 0x0002B4D0 File Offset: 0x000296D0
public bool MulticastLoopback
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.protocol_type == ProtocolType.Tcp)
{
throw new SocketException(10042);
}
bool flag;
if (this.address_family == AddressFamily.InterNetwork)
{
flag = (int)this.GetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastLoopback) != 0;
}
else
{
if (this.address_family != AddressFamily.InterNetworkV6)
{
throw new NotSupportedException("This property is only valid for InterNetwork and InterNetworkV6 sockets");
}
flag = (int)this.GetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.MulticastLoopback) != 0;
}
return flag;
}
set
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.protocol_type == ProtocolType.Tcp)
{
throw new SocketException(10042);
}
if (this.address_family == AddressFamily.InterNetwork)
{
this.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastLoopback, (!value) ? 0 : 1);
}
else
{
if (this.address_family != AddressFamily.InterNetworkV6)
{
throw new NotSupportedException("This property is only valid for InterNetwork and InterNetworkV6 sockets");
}
this.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.MulticastLoopback, (!value) ? 0 : 1);
}
}
}
/// <summary>Specifies whether the socket should only use Overlapped I/O mode.</summary>
/// <returns>true if the <see cref="T:System.Net.Sockets.Socket" /> uses only overlapped I/O; otherwise, false. The default is false.</returns>
/// <exception cref="T:System.InvalidOperationException">The socket has been bound to a completion port.</exception>
// Token: 0x1700055F RID: 1375
// (get) Token: 0x06000FB6 RID: 4022 RVA: 0x0002B578 File Offset: 0x00029778
// (set) Token: 0x06000FB7 RID: 4023 RVA: 0x0002B580 File Offset: 0x00029780
[global::System.MonoTODO("This doesn't do anything on Mono yet")]
public bool UseOnlyOverlappedIO
{
get
{
return this.useoverlappedIO;
}
set
{
this.useoverlappedIO = value;
}
}
/// <summary>Gets the operating system handle for the <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>An <see cref="T:System.IntPtr" /> that represents the operating system handle for the <see cref="T:System.Net.Sockets.Socket" />.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x17000560 RID: 1376
// (get) Token: 0x06000FB8 RID: 4024 RVA: 0x0002B58C File Offset: 0x0002978C
public IntPtr Handle
{
get
{
return this.socket;
}
}
// Token: 0x06000FB9 RID: 4025
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern SocketAddress LocalEndPoint_internal(IntPtr socket, out int error);
/// <summary>Gets the local endpoint.</summary>
/// <returns>The <see cref="T:System.Net.EndPoint" /> that the <see cref="T:System.Net.Sockets.Socket" /> is using for communications.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x17000561 RID: 1377
// (get) Token: 0x06000FBA RID: 4026 RVA: 0x0002B594 File Offset: 0x00029794
public EndPoint LocalEndPoint
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.seed_endpoint == null)
{
return null;
}
int num;
SocketAddress socketAddress = Socket.LocalEndPoint_internal(this.socket, out num);
if (num != 0)
{
throw new SocketException(num);
}
return this.seed_endpoint.Create(socketAddress);
}
}
/// <summary>Gets the type of the <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>One of the <see cref="T:System.Net.Sockets.SocketType" /> values.</returns>
// Token: 0x17000562 RID: 1378
// (get) Token: 0x06000FBB RID: 4027 RVA: 0x0002B5FC File Offset: 0x000297FC
public SocketType SocketType
{
get
{
return this.socket_type;
}
}
/// <summary>Gets or sets a value that specifies the amount of time after which a synchronous <see cref="Overload:System.Net.Sockets.Socket.Send" /> call will time out.</summary>
/// <returns>The time-out value, in milliseconds. If you set the property with a value between 1 and 499, the value will be changed to 500. The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set operation is less than -1.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x17000563 RID: 1379
// (get) Token: 0x06000FBC RID: 4028 RVA: 0x0002B604 File Offset: 0x00029804
// (set) Token: 0x06000FBD RID: 4029 RVA: 0x0002B650 File Offset: 0x00029850
public int SendTimeout
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
return (int)this.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout);
}
set
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (value < -1)
{
throw new ArgumentOutOfRangeException("value", "The value specified for a set operation is less than -1");
}
if (value == -1)
{
value = 0;
}
this.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, value);
}
}
/// <summary>Gets or sets a value that specifies the amount of time after which a synchronous <see cref="Overload:System.Net.Sockets.Socket.Receive" /> call will time out.</summary>
/// <returns>The time-out value, in milliseconds. The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set operation is less than -1.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x17000564 RID: 1380
// (get) Token: 0x06000FBE RID: 4030 RVA: 0x0002B6B8 File Offset: 0x000298B8
// (set) Token: 0x06000FBF RID: 4031 RVA: 0x0002B704 File Offset: 0x00029904
public int ReceiveTimeout
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
return (int)this.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout);
}
set
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (value < -1)
{
throw new ArgumentOutOfRangeException("value", "The value specified for a set operation is less than -1");
}
if (value == -1)
{
value = 0;
}
this.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, value);
}
}
/// <summary>Begins an asynchronous operation to accept an incoming connection attempt.</summary>
/// <returns>Returns true if the I/O operation is pending. The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will be raised upon completion of the operation.Returns false if the I/O operation completed synchronously. The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will not be raised and the <paramref name="e" /> object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.</returns>
/// <param name="e">The <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object to use for this asynchronous socket operation.</param>
/// <exception cref="T:System.ArgumentException">An argument is not valid. This exception occurs if the buffer provided is not large enough. The buffer must be at least 2 * (sizeof(SOCKADDR_STORAGE + 16) bytes. This exception also occurs if multiple buffers are specified, the <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.BufferList" /> property is not null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">An argument is out of range. The exception occurs if the <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.Count" /> is less than 0.</exception>
/// <exception cref="T:System.InvalidOperationException">An invalid operation was requested. This exception occurs if the accepting <see cref="T:System.Net.Sockets.Socket" /> is not listening for connections or the accepted socket is bound. You must call the <see cref="M:System.Net.Sockets.Socket.Bind(System.Net.EndPoint)" /> and <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" /> method before calling the <see cref="M:System.Net.Sockets.Socket.AcceptAsync(System.Net.Sockets.SocketAsyncEventArgs)" /> method.This exception also occurs if the socket is already connected or a socket operation was already in progress using the specified <paramref name="e" /> parameter. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.NotSupportedException">Windows XP or later is required for this method.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06000FC0 RID: 4032 RVA: 0x0002B76C File Offset: 0x0002996C
public bool AcceptAsync(SocketAsyncEventArgs e)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (!this.IsBound)
{
throw new InvalidOperationException("You must call the Bind method before performing this operation.");
}
if (!this.islistening)
{
throw new InvalidOperationException("You must call the Listen method before performing this operation.");
}
if (e.BufferList != null)
{
throw new ArgumentException("Multiple buffers cannot be used with this method.");
}
if (e.Count < 0)
{
throw new ArgumentOutOfRangeException("e.Count");
}
Socket acceptSocket = e.AcceptSocket;
if (acceptSocket != null)
{
if (acceptSocket.IsBound || acceptSocket.Connected)
{
throw new InvalidOperationException("AcceptSocket: The socket must not be bound or connected.");
}
}
else
{
e.AcceptSocket = new Socket(this.AddressFamily, this.SocketType, this.ProtocolType);
}
try
{
e.DoOperation(SocketAsyncOperation.Accept, this);
}
catch
{
((IDisposable)e).Dispose();
throw;
}
return true;
}
// Token: 0x06000FC1 RID: 4033
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern IntPtr Accept_internal(IntPtr sock, out int error, bool blocking);
/// <summary>Creates a new <see cref="T:System.Net.Sockets.Socket" /> for a newly created connection.</summary>
/// <returns>A <see cref="T:System.Net.Sockets.Socket" /> for a newly created connection.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.InvalidOperationException">The accepting socket is not listening for connections. You must call <see cref="M:System.Net.Sockets.Socket.Bind(System.Net.EndPoint)" /> and <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" /> before calling <see cref="M:System.Net.Sockets.Socket.Accept" />. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FC2 RID: 4034 RVA: 0x0002B884 File Offset: 0x00029A84
public Socket Accept()
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
int num = 0;
IntPtr intPtr = (IntPtr)(-1);
this.blocking_thread = Thread.CurrentThread;
try
{
intPtr = Socket.Accept_internal(this.socket, out num, this.blocking);
}
catch (ThreadAbortException)
{
if (this.disposed)
{
Thread.ResetAbort();
num = 10004;
}
}
finally
{
this.blocking_thread = null;
}
if (num != 0)
{
throw new SocketException(num);
}
return new Socket(this.AddressFamily, this.SocketType, this.ProtocolType, intPtr)
{
seed_endpoint = this.seed_endpoint,
Blocking = this.Blocking
};
}
// Token: 0x06000FC3 RID: 4035 RVA: 0x0002B97C File Offset: 0x00029B7C
internal void Accept(Socket acceptSocket)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
int num = 0;
IntPtr intPtr = (IntPtr)(-1);
this.blocking_thread = Thread.CurrentThread;
try
{
intPtr = Socket.Accept_internal(this.socket, out num, this.blocking);
}
catch (ThreadAbortException)
{
if (this.disposed)
{
Thread.ResetAbort();
num = 10004;
}
}
finally
{
this.blocking_thread = null;
}
if (num != 0)
{
throw new SocketException(num);
}
acceptSocket.address_family = this.AddressFamily;
acceptSocket.socket_type = this.SocketType;
acceptSocket.protocol_type = this.ProtocolType;
acceptSocket.socket = intPtr;
acceptSocket.connected = true;
acceptSocket.seed_endpoint = this.seed_endpoint;
acceptSocket.Blocking = this.Blocking;
}
/// <summary>Begins an asynchronous operation to accept an incoming connection attempt.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous <see cref="T:System.Net.Sockets.Socket" /> creation.</returns>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.NotSupportedException">Windows NT is required for this method. </exception>
/// <exception cref="T:System.InvalidOperationException">The accepting socket is not listening for connections. You must call <see cref="M:System.Net.Sockets.Socket.Bind(System.Net.EndPoint)" /> and <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" /> before calling <see cref="M:System.Net.Sockets.Socket.BeginAccept(System.AsyncCallback,System.Object)" />.-or- The accepted socket is bound. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="receiveSize" /> is less than 0. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06000FC4 RID: 4036 RVA: 0x0002BA8C File Offset: 0x00029C8C
public IAsyncResult BeginAccept(AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (!this.isbound || !this.islistening)
{
throw new InvalidOperationException();
}
Socket.SocketAsyncResult socketAsyncResult = new Socket.SocketAsyncResult(this, state, callback, Socket.SocketOperation.Accept);
Socket.Worker worker = new Socket.Worker(socketAsyncResult);
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(worker.Accept);
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
return socketAsyncResult;
}
/// <summary>Begins an asynchronous operation to accept an incoming connection attempt and receives the first block of data sent by the client application.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous <see cref="T:System.Net.Sockets.Socket" /> creation.</returns>
/// <param name="receiveSize">The number of bytes to accept from the sender. </param>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.NotSupportedException">Windows NT is required for this method. </exception>
/// <exception cref="T:System.InvalidOperationException">The accepting socket is not listening for connections. You must call <see cref="M:System.Net.Sockets.Socket.Bind(System.Net.EndPoint)" /> and <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" /> before calling <see cref="M:System.Net.Sockets.Socket.BeginAccept(System.AsyncCallback,System.Object)" />.-or- The accepted socket is bound. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="receiveSize" /> is less than 0. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06000FC5 RID: 4037 RVA: 0x0002BB04 File Offset: 0x00029D04
public IAsyncResult BeginAccept(int receiveSize, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (receiveSize < 0)
{
throw new ArgumentOutOfRangeException("receiveSize", "receiveSize is less than zero");
}
Socket.SocketAsyncResult socketAsyncResult = new Socket.SocketAsyncResult(this, state, callback, Socket.SocketOperation.AcceptReceive);
Socket.Worker worker = new Socket.Worker(socketAsyncResult);
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(worker.AcceptReceive);
socketAsyncResult.Buffer = new byte[receiveSize];
socketAsyncResult.Offset = 0;
socketAsyncResult.Size = receiveSize;
socketAsyncResult.SockFlags = SocketFlags.None;
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
return socketAsyncResult;
}
/// <summary>Begins an asynchronous operation to accept an incoming connection attempt from a specified socket and receives the first block of data sent by the client application.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> object that references the asynchronous <see cref="T:System.Net.Sockets.Socket" /> object creation.</returns>
/// <param name="acceptSocket">The accepted <see cref="T:System.Net.Sockets.Socket" /> object. This value may be null. </param>
/// <param name="receiveSize">The maximum number of bytes to receive. </param>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.NotSupportedException">Windows NT is required for this method. </exception>
/// <exception cref="T:System.InvalidOperationException">The accepting socket is not listening for connections. You must call <see cref="M:System.Net.Sockets.Socket.Bind(System.Net.EndPoint)" /> and <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" /> before calling <see cref="M:System.Net.Sockets.Socket.BeginAccept(System.AsyncCallback,System.Object)" />.-or- The accepted socket is bound. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="receiveSize" /> is less than 0. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06000FC6 RID: 4038 RVA: 0x0002BB9C File Offset: 0x00029D9C
public IAsyncResult BeginAccept(Socket acceptSocket, int receiveSize, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (receiveSize < 0)
{
throw new ArgumentOutOfRangeException("receiveSize", "receiveSize is less than zero");
}
if (acceptSocket != null)
{
if (acceptSocket.disposed && acceptSocket.closed)
{
throw new ObjectDisposedException(acceptSocket.GetType().ToString());
}
if (acceptSocket.IsBound)
{
throw new InvalidOperationException();
}
if (acceptSocket.ProtocolType != ProtocolType.Tcp)
{
throw new SocketException(10022);
}
}
Socket.SocketAsyncResult socketAsyncResult = new Socket.SocketAsyncResult(this, state, callback, Socket.SocketOperation.AcceptReceive);
Socket.Worker worker = new Socket.Worker(socketAsyncResult);
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(worker.AcceptReceive);
socketAsyncResult.Buffer = new byte[receiveSize];
socketAsyncResult.Offset = 0;
socketAsyncResult.Size = receiveSize;
socketAsyncResult.SockFlags = SocketFlags.None;
socketAsyncResult.AcceptSocket = acceptSocket;
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
return socketAsyncResult;
}
/// <summary>Begins an asynchronous request for a remote host connection.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous connection.</returns>
/// <param name="remoteEP">An <see cref="T:System.Net.EndPoint" /> that represents the remote host. </param>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller higher in the call stack does not have permission for the requested operation. </exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Net.Sockets.Socket" /> is <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" />ing.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FC7 RID: 4039 RVA: 0x0002BC90 File Offset: 0x00029E90
public IAsyncResult BeginConnect(EndPoint end_point, AsyncCallback callback, object state)
{
return this.BeginConnect(end_point, callback, state, false);
}
// Token: 0x06000FC8 RID: 4040 RVA: 0x0002BC9C File Offset: 0x00029E9C
internal IAsyncResult BeginConnect(EndPoint end_point, AsyncCallback callback, object state, bool bypassSocketSecurity)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (end_point == null)
{
throw new ArgumentNullException("end_point");
}
Socket.SocketAsyncResult socketAsyncResult = new Socket.SocketAsyncResult(this, state, callback, Socket.SocketOperation.Connect);
socketAsyncResult.EndPoint = end_point;
if (end_point is IPEndPoint)
{
IPEndPoint ipendPoint = (IPEndPoint)end_point;
if (ipendPoint.Address.Equals(IPAddress.Any) || ipendPoint.Address.Equals(IPAddress.IPv6Any))
{
socketAsyncResult.Complete(new SocketException(10049), true);
return socketAsyncResult;
}
}
int num = 0;
if (!this.blocking)
{
SocketAddress socketAddress = end_point.Serialize();
Socket.Connect_internal(this.socket, socketAddress, out num);
if (num == 0)
{
this.connected = true;
socketAsyncResult.Complete(true);
}
else if (num != 10036 && num != 10035)
{
this.connected = false;
socketAsyncResult.Complete(new SocketException(num), true);
}
}
if (this.blocking || num == 10036 || num == 10035)
{
this.connected = false;
Socket.Worker worker = new Socket.Worker(socketAsyncResult, bypassSocketSecurity);
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(worker.Connect);
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
}
return socketAsyncResult;
}
/// <summary>Begins an asynchronous request for a remote host connection. The host is specified by an <see cref="T:System.Net.IPAddress" /> and a port number.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous connection.</returns>
/// <param name="address">The <see cref="T:System.Net.IPAddress" /> of the remote host.</param>
/// <param name="port">The port number of the remote host.</param>
/// <param name="requestCallback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the connect operation is complete. </param>
/// <param name="state">A user-defined object that contains information about the connect operation. This object is passed to the <paramref name="requestCallback" /> delegate when the operation is complete.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="address" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Net.Sockets.Socket" /> is not in the socket family.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The port number is not valid.</exception>
/// <exception cref="T:System.ArgumentException">The length of <paramref name="address" /> is zero.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Net.Sockets.Socket" /> is <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" />ing.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FC9 RID: 4041 RVA: 0x0002BDF4 File Offset: 0x00029FF4
public IAsyncResult BeginConnect(IPAddress address, int port, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (address == null)
{
throw new ArgumentNullException("address");
}
if (address.ToString().Length == 0)
{
throw new ArgumentException("The length of the IP address is zero");
}
if (this.islistening)
{
throw new InvalidOperationException();
}
IPEndPoint ipendPoint = new IPEndPoint(address, port);
return this.BeginConnect(ipendPoint, callback, state);
}
/// <summary>Begins an asynchronous request for a remote host connection. The host is specified by an <see cref="T:System.Net.IPAddress" /> array and a port number.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous connections.</returns>
/// <param name="addresses">At least one <see cref="T:System.Net.IPAddress" />, designating the remote host.</param>
/// <param name="port">The port number of the remote host.</param>
/// <param name="requestCallback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the connect operation is complete. </param>
/// <param name="state">A user-defined object that contains information about the connect operation. This object is passed to the <paramref name="requestCallback" /> delegate when the operation is complete.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="addresses" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.NotSupportedException">This method is valid for sockets that use <see cref="F:System.Net.Sockets.AddressFamily.InterNetwork" /> or <see cref="F:System.Net.Sockets.AddressFamily.InterNetworkV6" />.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The port number is not valid.</exception>
/// <exception cref="T:System.ArgumentException">The length of <paramref name="address" /> is zero.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Net.Sockets.Socket" /> is <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" />ing.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FCA RID: 4042 RVA: 0x0002BE78 File Offset: 0x0002A078
public IAsyncResult BeginConnect(IPAddress[] addresses, int port, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (addresses == null)
{
throw new ArgumentNullException("addresses");
}
if (this.AddressFamily != AddressFamily.InterNetwork && this.AddressFamily != AddressFamily.InterNetworkV6)
{
throw new NotSupportedException("This method is only valid for addresses in the InterNetwork or InterNetworkV6 families");
}
if (this.islistening)
{
throw new InvalidOperationException();
}
Socket.SocketAsyncResult socketAsyncResult = new Socket.SocketAsyncResult(this, state, callback, Socket.SocketOperation.Connect);
socketAsyncResult.Addresses = addresses;
socketAsyncResult.Port = port;
this.connected = false;
Socket.Worker worker = new Socket.Worker(socketAsyncResult);
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(worker.Connect);
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
return socketAsyncResult;
}
/// <summary>Begins an asynchronous request for a remote host connection. The host is specified by a host name and a port number.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous connection.</returns>
/// <param name="host">The name of the remote host.</param>
/// <param name="port">The port number of the remote host.</param>
/// <param name="requestCallback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the connect operation is complete. </param>
/// <param name="state">A user-defined object that contains information about the connect operation. This object is passed to the <paramref name="requestCallback" /> delegate when the operation is complete.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="host" /> is null. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.NotSupportedException">This method is valid for sockets in the <see cref="F:System.Net.Sockets.AddressFamily.InterNetwork" /> or <see cref="F:System.Net.Sockets.AddressFamily.InterNetworkV6" /> families.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The port number is not valid.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Net.Sockets.Socket" /> is <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" />ing.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FCB RID: 4043 RVA: 0x0002BF30 File Offset: 0x0002A130
public IAsyncResult BeginConnect(string host, int port, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (host == null)
{
throw new ArgumentNullException("host");
}
if (this.address_family != AddressFamily.InterNetwork && this.address_family != AddressFamily.InterNetworkV6)
{
throw new NotSupportedException("This method is valid only for sockets in the InterNetwork and InterNetworkV6 families");
}
if (this.islistening)
{
throw new InvalidOperationException();
}
IPAddress[] hostAddresses = Dns.GetHostAddresses(host);
return this.BeginConnect(hostAddresses, port, callback, state);
}
/// <summary>Begins an asynchronous request to disconnect from a remote endpoint.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> object that references the asynchronous operation.</returns>
/// <param name="reuseSocket">true if this socket can be reused after the connection is closed; otherwise, false. </param>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.NotSupportedException">The operating system is Windows 2000 or earlier, and this method requires Windows XP. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FCC RID: 4044 RVA: 0x0002BFBC File Offset: 0x0002A1BC
public IAsyncResult BeginDisconnect(bool reuseSocket, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
Socket.SocketAsyncResult socketAsyncResult = new Socket.SocketAsyncResult(this, state, callback, Socket.SocketOperation.Disconnect);
socketAsyncResult.ReuseSocket = reuseSocket;
Socket.Worker worker = new Socket.Worker(socketAsyncResult);
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(worker.Disconnect);
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
return socketAsyncResult;
}
/// <summary>Begins to asynchronously receive data from a connected <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous read.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for the received data. </param>
/// <param name="offset">The zero-based position in the <paramref name="buffer" /> parameter at which to store the received data. </param>
/// <param name="size">The number of bytes to receive. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="callback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the operation is complete. </param>
/// <param name="state">A user-defined object that contains information about the receive operation. This object is passed to the <see cref="M:System.Net.Sockets.Socket.EndReceive(System.IAsyncResult)" /> delegate when the operation is complete.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">
/// <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is greater than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06000FCD RID: 4045 RVA: 0x0002C020 File Offset: 0x0002A220
public IAsyncResult BeginReceive(byte[] buffer, int offset, int size, SocketFlags socket_flags, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (offset < 0 || offset > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset");
}
if (size < 0 || offset + size > buffer.Length)
{
throw new ArgumentOutOfRangeException("size");
}
Queue queue = this.readQ;
Socket.SocketAsyncResult socketAsyncResult;
lock (queue)
{
socketAsyncResult = new Socket.SocketAsyncResult(this, state, callback, Socket.SocketOperation.Receive);
socketAsyncResult.Buffer = buffer;
socketAsyncResult.Offset = offset;
socketAsyncResult.Size = size;
socketAsyncResult.SockFlags = socket_flags;
this.readQ.Enqueue(socketAsyncResult);
if (this.readQ.Count == 1)
{
Socket.Worker worker = new Socket.Worker(socketAsyncResult);
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(worker.Receive);
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
}
}
return socketAsyncResult;
}
/// <summary>Begins to asynchronously receive data from a connected <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous read.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for the received data.</param>
/// <param name="offset">The location in <paramref name="buffer" /> to store the received data. </param>
/// <param name="size">The number of bytes to receive. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values.</param>
/// <param name="errorCode">A <see cref="T:System.Net.Sockets.SocketError" /> object that stores the socket error.</param>
/// <param name="callback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the operation is complete.</param>
/// <param name="state">A user-defined object that contains information about the receive operation. This object is passed to the <see cref="M:System.Net.Sockets.Socket.EndReceive(System.IAsyncResult)" /> delegate when the operation is complete.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">
/// <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is greater than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter. </exception>
// Token: 0x06000FCE RID: 4046 RVA: 0x0002C138 File Offset: 0x0002A338
public IAsyncResult BeginReceive(byte[] buffer, int offset, int size, SocketFlags flags, out SocketError error, AsyncCallback callback, object state)
{
error = SocketError.Success;
return this.BeginReceive(buffer, offset, size, flags, callback, state);
}
/// <summary>Begins to asynchronously receive data from a connected <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous read.</returns>
/// <param name="buffers">An array of type <see cref="T:System.Byte" /> that is the storage location for the received data.</param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values.</param>
/// <param name="callback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the operation is complete.</param>
/// <param name="state">A user-defined object that contains information about the receive operation. This object is passed to the <see cref="M:System.Net.Sockets.Socket.EndReceive(System.IAsyncResult)" /> delegate when the operation is complete.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">
/// <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06000FCF RID: 4047 RVA: 0x0002C150 File Offset: 0x0002A350
[CLSCompliant(false)]
public IAsyncResult BeginReceive(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffers == null)
{
throw new ArgumentNullException("buffers");
}
Queue queue = this.readQ;
Socket.SocketAsyncResult socketAsyncResult;
lock (queue)
{
socketAsyncResult = new Socket.SocketAsyncResult(this, state, callback, Socket.SocketOperation.ReceiveGeneric);
socketAsyncResult.Buffers = buffers;
socketAsyncResult.SockFlags = socketFlags;
this.readQ.Enqueue(socketAsyncResult);
if (this.readQ.Count == 1)
{
Socket.Worker worker = new Socket.Worker(socketAsyncResult);
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(worker.ReceiveGeneric);
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
}
}
return socketAsyncResult;
}
/// <summary>Begins to asynchronously receive data from a connected <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous read.</returns>
/// <param name="buffers">An array of type <see cref="T:System.Byte" /> that is the storage location for the received data.</param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="errorCode">A <see cref="T:System.Net.Sockets.SocketError" /> object that stores the socket error.</param>
/// <param name="callback">An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the operation is complete.</param>
/// <param name="state">A user-defined object that contains information about the receive operation. This object is passed to the <see cref="M:System.Net.Sockets.Socket.EndReceive(System.IAsyncResult)" /> delegate when the operation is complete.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">
/// <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06000FD0 RID: 4048 RVA: 0x0002C220 File Offset: 0x0002A420
[CLSCompliant(false)]
public IAsyncResult BeginReceive(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
{
errorCode = SocketError.Success;
return this.BeginReceive(buffers, socketFlags, callback, state);
}
/// <summary>Begins to asynchronously receive data from a specified network device.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous read.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for the received data. </param>
/// <param name="offset">The zero-based position in the <paramref name="buffer" /> parameter at which to store the data. </param>
/// <param name="size">The number of bytes to receive. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="remoteEP">An <see cref="T:System.Net.EndPoint" /> that represents the source of the data. </param>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null.-or- <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is greater than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller higher in the call stack does not have permission for the requested operation. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FD1 RID: 4049 RVA: 0x0002C234 File Offset: 0x0002A434
public IAsyncResult BeginReceiveFrom(byte[] buffer, int offset, int size, SocketFlags socket_flags, ref EndPoint remote_end, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (offset < 0)
{
throw new ArgumentOutOfRangeException("offset", "offset must be >= 0");
}
if (size < 0)
{
throw new ArgumentOutOfRangeException("size", "size must be >= 0");
}
if (offset + size > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset, size", "offset + size exceeds the buffer length");
}
Queue queue = this.readQ;
Socket.SocketAsyncResult socketAsyncResult;
lock (queue)
{
socketAsyncResult = new Socket.SocketAsyncResult(this, state, callback, Socket.SocketOperation.ReceiveFrom);
socketAsyncResult.Buffer = buffer;
socketAsyncResult.Offset = offset;
socketAsyncResult.Size = size;
socketAsyncResult.SockFlags = socket_flags;
socketAsyncResult.EndPoint = remote_end;
this.readQ.Enqueue(socketAsyncResult);
if (this.readQ.Count == 1)
{
Socket.Worker worker = new Socket.Worker(socketAsyncResult);
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(worker.ReceiveFrom);
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
}
}
return socketAsyncResult;
}
/// <summary>Begins to asynchronously receive the specified number of bytes of data into the specified location of the data buffer, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />, and stores the endpoint and packet information..</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous read.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for the received data. </param>
/// <param name="offset">The zero-based position in the <paramref name="buffer" /> parameter at which to store the data.</param>
/// <param name="size">The number of bytes to receive. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values.</param>
/// <param name="remoteEP">An <see cref="T:System.Net.EndPoint" /> that represents the source of the data.</param>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate.</param>
/// <param name="state">An object that contains state information for this request.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null.-or- <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is greater than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.NotSupportedException">The operating system is Windows 2000 or earlier, and this method requires Windows XP.</exception>
// Token: 0x06000FD2 RID: 4050 RVA: 0x0002C364 File Offset: 0x0002A564
[global::System.MonoTODO]
public IAsyncResult BeginReceiveMessageFrom(byte[] buffer, int offset, int size, SocketFlags socketFlags, ref EndPoint remoteEP, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (remoteEP == null)
{
throw new ArgumentNullException("remoteEP");
}
if (offset < 0 || offset > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset");
}
if (size < 0 || offset + size > buffer.Length)
{
throw new ArgumentOutOfRangeException("size");
}
throw new NotImplementedException();
}
/// <summary>Sends data asynchronously to a connected <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous send.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the data to send. </param>
/// <param name="offset">The zero-based position in the <paramref name="buffer" /> parameter at which to begin sending data. </param>
/// <param name="size">The number of bytes to send. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See remarks section below. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is less than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06000FD3 RID: 4051 RVA: 0x0002C3FC File Offset: 0x0002A5FC
public IAsyncResult BeginSend(byte[] buffer, int offset, int size, SocketFlags socket_flags, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (offset < 0)
{
throw new ArgumentOutOfRangeException("offset", "offset must be >= 0");
}
if (size < 0)
{
throw new ArgumentOutOfRangeException("size", "size must be >= 0");
}
if (offset + size > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset, size", "offset + size exceeds the buffer length");
}
if (!this.connected)
{
throw new SocketException(10057);
}
Queue queue = this.writeQ;
Socket.SocketAsyncResult socketAsyncResult;
lock (queue)
{
socketAsyncResult = new Socket.SocketAsyncResult(this, state, callback, Socket.SocketOperation.Send);
socketAsyncResult.Buffer = buffer;
socketAsyncResult.Offset = offset;
socketAsyncResult.Size = size;
socketAsyncResult.SockFlags = socket_flags;
this.writeQ.Enqueue(socketAsyncResult);
if (this.writeQ.Count == 1)
{
Socket.Worker worker = new Socket.Worker(socketAsyncResult);
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(worker.Send);
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
}
}
return socketAsyncResult;
}
/// <summary>Sends data asynchronously to a connected <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous send.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the data to send. </param>
/// <param name="offset">The zero-based position in the <paramref name="buffer" /> parameter at which to begin sending data. </param>
/// <param name="size">The number of bytes to send. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="errorCode">A <see cref="T:System.Net.Sockets.SocketError" /> object that stores the socket error.</param>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See remarks section below. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is less than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06000FD4 RID: 4052 RVA: 0x0002C53C File Offset: 0x0002A73C
public IAsyncResult BeginSend(byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
{
if (!this.connected)
{
errorCode = SocketError.NotConnected;
throw new SocketException((int)errorCode);
}
errorCode = SocketError.Success;
return this.BeginSend(buffer, offset, size, socketFlags, callback, state);
}
/// <summary>Sends data asynchronously to a connected <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous send.</returns>
/// <param name="buffers">An array of type <see cref="T:System.Byte" /> that contains the data to send. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffers" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="buffers" /> is empty.</exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See remarks section below. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06000FD5 RID: 4053 RVA: 0x0002C570 File Offset: 0x0002A770
public IAsyncResult BeginSend(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffers == null)
{
throw new ArgumentNullException("buffers");
}
if (!this.connected)
{
throw new SocketException(10057);
}
Queue queue = this.writeQ;
Socket.SocketAsyncResult socketAsyncResult;
lock (queue)
{
socketAsyncResult = new Socket.SocketAsyncResult(this, state, callback, Socket.SocketOperation.SendGeneric);
socketAsyncResult.Buffers = buffers;
socketAsyncResult.SockFlags = socketFlags;
this.writeQ.Enqueue(socketAsyncResult);
if (this.writeQ.Count == 1)
{
Socket.Worker worker = new Socket.Worker(socketAsyncResult);
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(worker.SendGeneric);
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
}
}
return socketAsyncResult;
}
/// <summary>Sends data asynchronously to a connected <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous send.</returns>
/// <param name="buffers">An array of type <see cref="T:System.Byte" /> that contains the data to send. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values.</param>
/// <param name="errorCode">A <see cref="T:System.Net.Sockets.SocketError" /> object that stores the socket error.</param>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffers" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="buffers" /> is empty.</exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See remarks section below. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06000FD6 RID: 4054 RVA: 0x0002C658 File Offset: 0x0002A858
[CLSCompliant(false)]
public IAsyncResult BeginSend(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
{
if (!this.connected)
{
errorCode = SocketError.NotConnected;
throw new SocketException((int)errorCode);
}
errorCode = SocketError.Success;
return this.BeginSend(buffers, socketFlags, callback, state);
}
/// <summary>Sends the file <paramref name="fileName" /> to a connected <see cref="T:System.Net.Sockets.Socket" /> object using the <see cref="F:System.Net.Sockets.TransmitFileOptions.UseDefaultWorkerThread" /> flag.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> object that represents the asynchronous send.</returns>
/// <param name="fileName">A string that contains the path and name of the file to send. This parameter can be null. </param>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.NotSupportedException">The socket is not connected to a remote host. </exception>
/// <exception cref="T:System.IO.FileNotFoundException">The file <paramref name="fileName" /> was not found. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See remarks section below. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FD7 RID: 4055 RVA: 0x0002C684 File Offset: 0x0002A884
public IAsyncResult BeginSendFile(string fileName, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (!this.connected)
{
throw new NotSupportedException();
}
if (!File.Exists(fileName))
{
throw new FileNotFoundException();
}
return this.BeginSendFile(fileName, null, null, TransmitFileOptions.UseDefaultWorkerThread, callback, state);
}
/// <summary>Sends a file and buffers of data asynchronously to a connected <see cref="T:System.Net.Sockets.Socket" /> object.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> object that represents the asynchronous operation.</returns>
/// <param name="fileName">A string that contains the path and name of the file to be sent. This parameter can be null. </param>
/// <param name="preBuffer">A <see cref="T:System.Byte" /> array that contains data to be sent before the file is sent. This parameter can be null. </param>
/// <param name="postBuffer">A <see cref="T:System.Byte" /> array that contains data to be sent after the file is sent. This parameter can be null. </param>
/// <param name="flags">A bitwise combination of <see cref="T:System.Net.Sockets.TransmitFileOptions" /> values. </param>
/// <param name="callback">An <see cref="T:System.AsyncCallback" /> delegate to be invoked when this operation completes. This parameter can be null. </param>
/// <param name="state">A user-defined object that contains state information for this request. This parameter can be null. </param>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See remarks section below. </exception>
/// <exception cref="T:System.NotSupportedException">The operating system is not Windows NT or later.- or - The socket is not connected to a remote host. </exception>
/// <exception cref="T:System.IO.FileNotFoundException">The file <paramref name="fileName" /> was not found. </exception>
// Token: 0x06000FD8 RID: 4056 RVA: 0x0002C6E8 File Offset: 0x0002A8E8
public IAsyncResult BeginSendFile(string fileName, byte[] preBuffer, byte[] postBuffer, TransmitFileOptions flags, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (!this.connected)
{
throw new NotSupportedException();
}
if (!File.Exists(fileName))
{
throw new FileNotFoundException();
}
Socket.SendFileHandler sendFileHandler = new Socket.SendFileHandler(this.SendFile);
return new Socket.SendFileAsyncResult(sendFileHandler, sendFileHandler.BeginInvoke(fileName, preBuffer, postBuffer, flags, callback, state));
}
/// <summary>Sends data asynchronously to a specific remote host.</summary>
/// <returns>An <see cref="T:System.IAsyncResult" /> that references the asynchronous send.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the data to send. </param>
/// <param name="offset">The zero-based position in <paramref name="buffer" /> at which to begin sending data. </param>
/// <param name="size">The number of bytes to send. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="remoteEP">An <see cref="T:System.Net.EndPoint" /> that represents the remote device. </param>
/// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
/// <param name="state">An object that contains state information for this request. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null.-or- <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is greater than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller higher in the call stack does not have permission for the requested operation. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FD9 RID: 4057 RVA: 0x0002C760 File Offset: 0x0002A960
public IAsyncResult BeginSendTo(byte[] buffer, int offset, int size, SocketFlags socket_flags, EndPoint remote_end, AsyncCallback callback, object state)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (offset < 0)
{
throw new ArgumentOutOfRangeException("offset", "offset must be >= 0");
}
if (size < 0)
{
throw new ArgumentOutOfRangeException("size", "size must be >= 0");
}
if (offset + size > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset, size", "offset + size exceeds the buffer length");
}
Queue queue = this.writeQ;
Socket.SocketAsyncResult socketAsyncResult;
lock (queue)
{
socketAsyncResult = new Socket.SocketAsyncResult(this, state, callback, Socket.SocketOperation.SendTo);
socketAsyncResult.Buffer = buffer;
socketAsyncResult.Offset = offset;
socketAsyncResult.Size = size;
socketAsyncResult.SockFlags = socket_flags;
socketAsyncResult.EndPoint = remote_end;
this.writeQ.Enqueue(socketAsyncResult);
if (this.writeQ.Count == 1)
{
Socket.Worker worker = new Socket.Worker(socketAsyncResult);
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(worker.SendTo);
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
}
}
return socketAsyncResult;
}
// Token: 0x06000FDA RID: 4058
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Bind_internal(IntPtr sock, SocketAddress sa, out int error);
/// <summary>Associates a <see cref="T:System.Net.Sockets.Socket" /> with a local endpoint.</summary>
/// <param name="localEP">The local <see cref="T:System.Net.EndPoint" /> to associate with the <see cref="T:System.Net.Sockets.Socket" />. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="localEP" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller higher in the call stack does not have permission for the requested operation. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FDB RID: 4059 RVA: 0x0002C890 File Offset: 0x0002AA90
public void Bind(EndPoint local_end)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (local_end == null)
{
throw new ArgumentNullException("local_end");
}
if (Environment.SocketSecurityEnabled && Socket.current_bind_count >= this.max_bind_count)
{
throw new SecurityException("Too many sockets are bound, maximum count in the webplayer is " + this.max_bind_count);
}
int num;
Socket.Bind_internal(this.socket, local_end.Serialize(), out num);
if (num != 0)
{
throw new SocketException(num);
}
if (num == 0)
{
this.isbound = true;
}
if (Environment.SocketSecurityEnabled)
{
Socket.current_bind_count++;
}
this.seed_endpoint = local_end;
}
/// <summary>Begins an asynchronous request for a remote host connection.</summary>
/// <returns>Returns true if the I/O operation is pending. The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will be raised upon completion of the operation. Returns false if the I/O operation completed synchronously. In this case, The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will not be raised and the <paramref name="e" /> object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation. </returns>
/// <param name="e">The <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object to use for this asynchronous socket operation.</param>
/// <exception cref="T:System.ArgumentException">An argument is not valid. This exception occurs if multiple buffers are specified, the <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.BufferList" /> property is not null. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="e" /> parameter cannot be null and the <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.RemoteEndPoint" /> cannot be null.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Net.Sockets.Socket" /> is listening or a socket operation was already in progress using the <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object specified in the <paramref name="e" /> parameter.</exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information.</exception>
/// <exception cref="T:System.NotSupportedException">Windows XP or later is required for this method. This exception also occurs if the local endpoint and the <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.RemoteEndPoint" /> are not the same address family.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller higher in the call stack does not have permission for the requested operation.</exception>
// Token: 0x06000FDC RID: 4060 RVA: 0x0002C954 File Offset: 0x0002AB54
public bool ConnectAsync(SocketAsyncEventArgs e)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.islistening)
{
throw new InvalidOperationException("You may not perform this operation after calling the Listen method.");
}
if (e.RemoteEndPoint == null)
{
throw new ArgumentNullException("remoteEP", "Value cannot be null.");
}
if (e.BufferList != null)
{
throw new ArgumentException("Multiple buffers cannot be used with this method.");
}
e.DoOperation(SocketAsyncOperation.Connect, this);
return true;
}
/// <summary>Establishes a connection to a remote host. The host is specified by an IP address and a port number.</summary>
/// <param name="address">The IP address of the remote host.</param>
/// <param name="port">The port number of the remote host.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="address" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The port number is not valid.</exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.NotSupportedException">This method is valid for sockets in the <see cref="F:System.Net.Sockets.AddressFamily.InterNetwork" /> or <see cref="F:System.Net.Sockets.AddressFamily.InterNetworkV6" /> families.</exception>
/// <exception cref="T:System.ArgumentException">The length of <paramref name="address" /> is zero.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Net.Sockets.Socket" /> is <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" />ing.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FDD RID: 4061 RVA: 0x0002C9D8 File Offset: 0x0002ABD8
public void Connect(IPAddress address, int port)
{
this.Connect(new IPEndPoint(address, port));
}
/// <summary>Establishes a connection to a remote host. The host is specified by an array of IP addresses and a port number.</summary>
/// <param name="addresses">The IP addresses of the remote host.</param>
/// <param name="port">The port number of the remote host.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="addresses" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The port number is not valid.</exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.NotSupportedException">This method is valid for sockets in the <see cref="F:System.Net.Sockets.AddressFamily.InterNetwork" /> or <see cref="F:System.Net.Sockets.AddressFamily.InterNetworkV6" /> families.</exception>
/// <exception cref="T:System.ArgumentException">The length of <paramref name="address" /> is zero.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Net.Sockets.Socket" /> is <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" />ing.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FDE RID: 4062 RVA: 0x0002C9E8 File Offset: 0x0002ABE8
public void Connect(IPAddress[] addresses, int port)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (addresses == null)
{
throw new ArgumentNullException("addresses");
}
if (this.AddressFamily != AddressFamily.InterNetwork && this.AddressFamily != AddressFamily.InterNetworkV6)
{
throw new NotSupportedException("This method is only valid for addresses in the InterNetwork or InterNetworkV6 families");
}
if (this.islistening)
{
throw new InvalidOperationException();
}
int num = 0;
foreach (IPAddress ipaddress in addresses)
{
IPEndPoint ipendPoint = new IPEndPoint(ipaddress, port);
SocketAddress socketAddress = ipendPoint.Serialize();
Socket.Connect_internal(this.socket, socketAddress, out num);
if (num == 0)
{
this.connected = true;
this.seed_endpoint = ipendPoint;
return;
}
if (num == 10036 || num == 10035)
{
if (!this.blocking)
{
this.Poll(-1, SelectMode.SelectWrite);
num = (int)this.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error);
if (num == 0)
{
this.connected = true;
this.seed_endpoint = ipendPoint;
return;
}
}
}
}
if (num != 0)
{
throw new SocketException(num);
}
}
/// <summary>Establishes a connection to a remote host. The host is specified by a host name and a port number.</summary>
/// <param name="host">The name of the remote host.</param>
/// <param name="port">The port number of the remote host.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="host" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The port number is not valid.</exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.NotSupportedException">This method is valid for sockets in the <see cref="F:System.Net.Sockets.AddressFamily.InterNetwork" /> or <see cref="F:System.Net.Sockets.AddressFamily.InterNetworkV6" /> families.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Net.Sockets.Socket" /> is <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" />ing.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FDF RID: 4063 RVA: 0x0002CB20 File Offset: 0x0002AD20
public void Connect(string host, int port)
{
IPAddress[] hostAddresses = Dns.GetHostAddresses(host);
this.Connect(hostAddresses, port);
}
/// <summary>Begins an asynchronous request to disconnect from a remote endpoint.</summary>
/// <returns>Returns true if the I/O operation is pending. The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will be raised upon completion of the operation. Returns false if the I/O operation completed synchronously. In this case, The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will not be raised and the <paramref name="e" /> object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.</returns>
/// <param name="e">The <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object to use for this asynchronous socket operation.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="e" /> parameter cannot be null.</exception>
/// <exception cref="T:System.InvalidOperationException">A socket operation was already in progress using the <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object specified in the <paramref name="e" /> parameter.</exception>
/// <exception cref="T:System.NotSupportedException">Windows XP or later is required for this method.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. </exception>
// Token: 0x06000FE0 RID: 4064 RVA: 0x0002CB3C File Offset: 0x0002AD3C
public bool DisconnectAsync(SocketAsyncEventArgs e)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
e.DoOperation(SocketAsyncOperation.Disconnect, this);
return true;
}
// Token: 0x06000FE1 RID: 4065
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Disconnect_internal(IntPtr sock, bool reuse, out int error);
/// <summary>Closes the socket connection and allows reuse of the socket.</summary>
/// <param name="reuseSocket">true if this socket can be reused after the current connection is closed; otherwise, false. </param>
/// <exception cref="T:System.PlatformNotSupportedException">This method requires Windows 2000 or earlier, or the exception will be thrown.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FE2 RID: 4066 RVA: 0x0002CB7C File Offset: 0x0002AD7C
public void Disconnect(bool reuseSocket)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
int num = 0;
Socket.Disconnect_internal(this.socket, reuseSocket, out num);
if (num == 0)
{
this.connected = false;
if (reuseSocket)
{
}
return;
}
if (num == 50)
{
throw new PlatformNotSupportedException();
}
throw new SocketException(num);
}
/// <summary>Duplicates the socket reference for the target process, and closes the socket for this process.</summary>
/// <returns>The socket reference to be passed to the target process.</returns>
/// <param name="targetProcessId">The ID of the target process where a duplicate of the socket reference is created.</param>
/// <exception cref="T:System.Net.Sockets.SocketException">
/// <paramref name="targetProcessID" /> is not a valid process id.-or- Duplication of the socket reference failed. </exception>
// Token: 0x06000FE3 RID: 4067 RVA: 0x0002CBE8 File Offset: 0x0002ADE8
[global::System.MonoTODO("Not implemented")]
public SocketInformation DuplicateAndClose(int targetProcessId)
{
throw new NotImplementedException();
}
/// <summary>Asynchronously accepts an incoming connection attempt and creates a new <see cref="T:System.Net.Sockets.Socket" /> to handle remote host communication.</summary>
/// <returns>A <see cref="T:System.Net.Sockets.Socket" /> to handle communication with the remote host.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> that stores state information for this asynchronous operation as well as any user defined data. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not created by a call to <see cref="M:System.Net.Sockets.Socket.BeginAccept(System.AsyncCallback,System.Object)" />. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndAccept(System.IAsyncResult)" /> method was previously called. </exception>
/// <exception cref="T:System.NotSupportedException">Windows NT is required for this method. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FE4 RID: 4068 RVA: 0x0002CBF0 File Offset: 0x0002ADF0
public Socket EndAccept(IAsyncResult result)
{
byte[] array;
int num;
return this.EndAccept(out array, out num, result);
}
/// <summary>Asynchronously accepts an incoming connection attempt and creates a new <see cref="T:System.Net.Sockets.Socket" /> object to handle remote host communication. This method returns a buffer that contains the initial data transferred.</summary>
/// <returns>A <see cref="T:System.Net.Sockets.Socket" /> object to handle communication with the remote host.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the bytes transferred. </param>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> object that stores state information for this asynchronous operation as well as any user defined data. </param>
/// <exception cref="T:System.NotSupportedException">Windows NT is required for this method. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is empty. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not created by a call to <see cref="M:System.Net.Sockets.Socket.BeginAccept(System.AsyncCallback,System.Object)" />. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndAccept(System.IAsyncResult)" /> method was previously called. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the <see cref="T:System.Net.Sockets.Socket" /> See the Remarks section for more information. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FE5 RID: 4069 RVA: 0x0002CC08 File Offset: 0x0002AE08
public Socket EndAccept(out byte[] buffer, IAsyncResult asyncResult)
{
int num;
return this.EndAccept(out buffer, out num, asyncResult);
}
/// <summary>Asynchronously accepts an incoming connection attempt and creates a new <see cref="T:System.Net.Sockets.Socket" /> object to handle remote host communication. This method returns a buffer that contains the initial data and the number of bytes transferred.</summary>
/// <returns>A <see cref="T:System.Net.Sockets.Socket" /> object to handle communication with the remote host.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the bytes transferred. </param>
/// <param name="bytesTransferred">The number of bytes transferred. </param>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> object that stores state information for this asynchronous operation as well as any user defined data. </param>
/// <exception cref="T:System.NotSupportedException">Windows NT is required for this method. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is empty. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not created by a call to <see cref="M:System.Net.Sockets.Socket.BeginAccept(System.AsyncCallback,System.Object)" />. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndAccept(System.IAsyncResult)" /> method was previously called. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the <see cref="T:System.Net.Sockets.Socket" />. See the Remarks section for more information. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FE6 RID: 4070 RVA: 0x0002CC20 File Offset: 0x0002AE20
public Socket EndAccept(out byte[] buffer, out int bytesTransferred, IAsyncResult asyncResult)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
Socket.SocketAsyncResult socketAsyncResult = asyncResult as Socket.SocketAsyncResult;
if (socketAsyncResult == null)
{
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
}
if (Interlocked.CompareExchange(ref socketAsyncResult.EndCalled, 1, 0) == 1)
{
throw this.InvalidAsyncOp("EndAccept");
}
if (!asyncResult.IsCompleted)
{
asyncResult.AsyncWaitHandle.WaitOne();
}
socketAsyncResult.CheckIfThrowDelayedException();
buffer = socketAsyncResult.Buffer;
bytesTransferred = socketAsyncResult.Total;
return socketAsyncResult.Socket;
}
/// <summary>Ends a pending asynchronous connection request.</summary>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> that stores state information and any user defined data for this asynchronous operation. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not returned by a call to the <see cref="M:System.Net.Sockets.Socket.BeginConnect(System.Net.EndPoint,System.AsyncCallback,System.Object)" /> method. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndConnect(System.IAsyncResult)" /> was previously called for the asynchronous connection. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06000FE7 RID: 4071 RVA: 0x0002CCD4 File Offset: 0x0002AED4
public void EndConnect(IAsyncResult result)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (result == null)
{
throw new ArgumentNullException("result");
}
Socket.SocketAsyncResult socketAsyncResult = result as Socket.SocketAsyncResult;
if (socketAsyncResult == null)
{
throw new ArgumentException("Invalid IAsyncResult", "result");
}
if (Interlocked.CompareExchange(ref socketAsyncResult.EndCalled, 1, 0) == 1)
{
throw this.InvalidAsyncOp("EndConnect");
}
if (!result.IsCompleted)
{
result.AsyncWaitHandle.WaitOne();
}
socketAsyncResult.CheckIfThrowDelayedException();
}
/// <summary>Ends a pending asynchronous disconnect request.</summary>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> object that stores state information and any user-defined data for this asynchronous operation. </param>
/// <exception cref="T:System.NotSupportedException">The operating system is Windows 2000 or earlier, and this method requires Windows XP. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not returned by a call to the <see cref="M:System.Net.Sockets.Socket.BeginDisconnect(System.Boolean,System.AsyncCallback,System.Object)" /> method. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndDisconnect(System.IAsyncResult)" /> was previously called for the asynchronous connection. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.Net.WebException">The disconnect request has timed out. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06000FE8 RID: 4072 RVA: 0x0002CD74 File Offset: 0x0002AF74
public void EndDisconnect(IAsyncResult asyncResult)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
Socket.SocketAsyncResult socketAsyncResult = asyncResult as Socket.SocketAsyncResult;
if (socketAsyncResult == null)
{
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
}
if (Interlocked.CompareExchange(ref socketAsyncResult.EndCalled, 1, 0) == 1)
{
throw this.InvalidAsyncOp("EndDisconnect");
}
if (!asyncResult.IsCompleted)
{
asyncResult.AsyncWaitHandle.WaitOne();
}
socketAsyncResult.CheckIfThrowDelayedException();
}
/// <summary>Ends a pending asynchronous read.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> that stores state information and any user defined data for this asynchronous operation. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not returned by a call to the <see cref="M:System.Net.Sockets.Socket.BeginReceive(System.Byte[],System.Int32,System.Int32,System.Net.Sockets.SocketFlags,System.AsyncCallback,System.Object)" /> method. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndReceive(System.IAsyncResult)" /> was previously called for the asynchronous read. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FE9 RID: 4073 RVA: 0x0002CE14 File Offset: 0x0002B014
public int EndReceive(IAsyncResult result)
{
SocketError socketError;
return this.EndReceive(result, out socketError);
}
/// <summary>Ends a pending asynchronous read.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> that stores state information and any user defined data for this asynchronous operation.</param>
/// <param name="errorCode">A <see cref="T:System.Net.Sockets.SocketError" /> object that stores the socket error.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not returned by a call to the <see cref="M:System.Net.Sockets.Socket.BeginReceive(System.Byte[],System.Int32,System.Int32,System.Net.Sockets.SocketFlags,System.AsyncCallback,System.Object)" /> method. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndReceive(System.IAsyncResult)" /> was previously called for the asynchronous read. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06000FEA RID: 4074 RVA: 0x0002CE2C File Offset: 0x0002B02C
public int EndReceive(IAsyncResult asyncResult, out SocketError errorCode)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
Socket.SocketAsyncResult socketAsyncResult = asyncResult as Socket.SocketAsyncResult;
if (socketAsyncResult == null)
{
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
}
if (Interlocked.CompareExchange(ref socketAsyncResult.EndCalled, 1, 0) == 1)
{
throw this.InvalidAsyncOp("EndReceive");
}
if (!asyncResult.IsCompleted)
{
asyncResult.AsyncWaitHandle.WaitOne();
}
errorCode = socketAsyncResult.ErrorCode;
socketAsyncResult.CheckIfThrowDelayedException();
return socketAsyncResult.Total;
}
/// <summary>Ends a pending asynchronous read from a specific endpoint.</summary>
/// <returns>If successful, the number of bytes received. If unsuccessful, returns 0.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> that stores state information and any user defined data for this asynchronous operation. </param>
/// <param name="endPoint">The source <see cref="T:System.Net.EndPoint" />. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not returned by a call to the <see cref="M:System.Net.Sockets.Socket.BeginReceiveFrom(System.Byte[],System.Int32,System.Int32,System.Net.Sockets.SocketFlags,System.Net.EndPoint@,System.AsyncCallback,System.Object)" /> method. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndReceiveFrom(System.IAsyncResult,System.Net.EndPoint@)" /> was previously called for the asynchronous read. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FEB RID: 4075 RVA: 0x0002CED8 File Offset: 0x0002B0D8
public int EndReceiveFrom(IAsyncResult result, ref EndPoint end_point)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (result == null)
{
throw new ArgumentNullException("result");
}
Socket.SocketAsyncResult socketAsyncResult = result as Socket.SocketAsyncResult;
if (socketAsyncResult == null)
{
throw new ArgumentException("Invalid IAsyncResult", "result");
}
if (Interlocked.CompareExchange(ref socketAsyncResult.EndCalled, 1, 0) == 1)
{
throw this.InvalidAsyncOp("EndReceiveFrom");
}
if (!result.IsCompleted)
{
result.AsyncWaitHandle.WaitOne();
}
socketAsyncResult.CheckIfThrowDelayedException();
end_point = socketAsyncResult.EndPoint;
return socketAsyncResult.Total;
}
/// <summary>Ends a pending asynchronous read from a specific endpoint. This method also reveals more information about the packet than <see cref="M:System.Net.Sockets.Socket.EndReceiveFrom(System.IAsyncResult,System.Net.EndPoint@)" />.</summary>
/// <returns>If successful, the number of bytes received. If unsuccessful, returns 0.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> that stores state information and any user defined data for this asynchronous operation.</param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values for the received packet.</param>
/// <param name="endPoint">The source <see cref="T:System.Net.EndPoint" />.</param>
/// <param name="ipPacketInformation">The <see cref="T:System.Net.IPAddress" /> and interface of the received packet.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null-or- <paramref name="endPoint" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not returned by a call to the <see cref="M:System.Net.Sockets.Socket.BeginReceiveMessageFrom(System.Byte[],System.Int32,System.Int32,System.Net.Sockets.SocketFlags,System.Net.EndPoint@,System.AsyncCallback,System.Object)" /> method. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndReceiveMessageFrom(System.IAsyncResult,System.Net.Sockets.SocketFlags@,System.Net.EndPoint@,System.Net.Sockets.IPPacketInformation@)" /> was previously called for the asynchronous read. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06000FEC RID: 4076 RVA: 0x0002CF84 File Offset: 0x0002B184
[global::System.MonoTODO]
public int EndReceiveMessageFrom(IAsyncResult asyncResult, ref SocketFlags socketFlags, ref EndPoint endPoint, out IPPacketInformation ipPacketInformation)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
if (endPoint == null)
{
throw new ArgumentNullException("endPoint");
}
Socket.SocketAsyncResult socketAsyncResult = asyncResult as Socket.SocketAsyncResult;
if (socketAsyncResult == null)
{
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
}
if (Interlocked.CompareExchange(ref socketAsyncResult.EndCalled, 1, 0) == 1)
{
throw this.InvalidAsyncOp("EndReceiveMessageFrom");
}
throw new NotImplementedException();
}
/// <summary>Ends a pending asynchronous send.</summary>
/// <returns>If successful, the number of bytes sent to the <see cref="T:System.Net.Sockets.Socket" />; otherwise, an invalid <see cref="T:System.Net.Sockets.Socket" /> error.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> that stores state information for this asynchronous operation. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not returned by a call to the <see cref="M:System.Net.Sockets.Socket.BeginSend(System.Byte[],System.Int32,System.Int32,System.Net.Sockets.SocketFlags,System.AsyncCallback,System.Object)" /> method. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndSend(System.IAsyncResult)" /> was previously called for the asynchronous send. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FED RID: 4077 RVA: 0x0002D01C File Offset: 0x0002B21C
public int EndSend(IAsyncResult result)
{
SocketError socketError;
return this.EndSend(result, out socketError);
}
/// <summary>Ends a pending asynchronous send.</summary>
/// <returns>If successful, the number of bytes sent to the <see cref="T:System.Net.Sockets.Socket" />; otherwise, an invalid <see cref="T:System.Net.Sockets.Socket" /> error.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> that stores state information for this asynchronous operation.</param>
/// <param name="errorCode">A <see cref="T:System.Net.Sockets.SocketError" /> object that stores the socket error.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not returned by a call to the <see cref="M:System.Net.Sockets.Socket.BeginSend(System.Byte[],System.Int32,System.Int32,System.Net.Sockets.SocketFlags,System.AsyncCallback,System.Object)" /> method. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndSend(System.IAsyncResult)" /> was previously called for the asynchronous send. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06000FEE RID: 4078 RVA: 0x0002D034 File Offset: 0x0002B234
public int EndSend(IAsyncResult asyncResult, out SocketError errorCode)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
Socket.SocketAsyncResult socketAsyncResult = asyncResult as Socket.SocketAsyncResult;
if (socketAsyncResult == null)
{
throw new ArgumentException("Invalid IAsyncResult", "result");
}
if (Interlocked.CompareExchange(ref socketAsyncResult.EndCalled, 1, 0) == 1)
{
throw this.InvalidAsyncOp("EndSend");
}
if (!asyncResult.IsCompleted)
{
asyncResult.AsyncWaitHandle.WaitOne();
}
errorCode = socketAsyncResult.ErrorCode;
socketAsyncResult.CheckIfThrowDelayedException();
return socketAsyncResult.Total;
}
/// <summary>Ends a pending asynchronous send of a file.</summary>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> object that stores state information for this asynchronous operation. </param>
/// <exception cref="T:System.NotSupportedException">Windows NT is required for this method. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is empty. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not returned by a call to the <see cref="M:System.Net.Sockets.Socket.BeginSendFile(System.String,System.AsyncCallback,System.Object)" /> method. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndSendFile(System.IAsyncResult)" /> was previously called for the asynchronous <see cref="M:System.Net.Sockets.Socket.BeginSendFile(System.String,System.AsyncCallback,System.Object)" />. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See remarks section below. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06000FEF RID: 4079 RVA: 0x0002D0E0 File Offset: 0x0002B2E0
public void EndSendFile(IAsyncResult asyncResult)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
Socket.SendFileAsyncResult sendFileAsyncResult = asyncResult as Socket.SendFileAsyncResult;
if (sendFileAsyncResult == null)
{
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
}
sendFileAsyncResult.Delegate.EndInvoke(sendFileAsyncResult.Original);
}
// Token: 0x06000FF0 RID: 4080 RVA: 0x0002D154 File Offset: 0x0002B354
private Exception InvalidAsyncOp(string method)
{
return new InvalidOperationException(method + " can only be called once per asynchronous operation");
}
/// <summary>Ends a pending asynchronous send to a specific location.</summary>
/// <returns>If successful, the number of bytes sent; otherwise, an invalid <see cref="T:System.Net.Sockets.Socket" /> error.</returns>
/// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> that stores state information and any user defined data for this asynchronous operation. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asyncResult" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asyncResult" /> was not returned by a call to the <see cref="M:System.Net.Sockets.Socket.BeginSendTo(System.Byte[],System.Int32,System.Int32,System.Net.Sockets.SocketFlags,System.Net.EndPoint,System.AsyncCallback,System.Object)" /> method. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <see cref="M:System.Net.Sockets.Socket.EndSendTo(System.IAsyncResult)" /> was previously called for the asynchronous send. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FF1 RID: 4081 RVA: 0x0002D168 File Offset: 0x0002B368
public int EndSendTo(IAsyncResult result)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (result == null)
{
throw new ArgumentNullException("result");
}
Socket.SocketAsyncResult socketAsyncResult = result as Socket.SocketAsyncResult;
if (socketAsyncResult == null)
{
throw new ArgumentException("Invalid IAsyncResult", "result");
}
if (Interlocked.CompareExchange(ref socketAsyncResult.EndCalled, 1, 0) == 1)
{
throw this.InvalidAsyncOp("EndSendTo");
}
if (!result.IsCompleted)
{
result.AsyncWaitHandle.WaitOne();
}
socketAsyncResult.CheckIfThrowDelayedException();
return socketAsyncResult.Total;
}
// Token: 0x06000FF2 RID: 4082
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void GetSocketOption_arr_internal(IntPtr socket, SocketOptionLevel level, SocketOptionName name, ref byte[] byte_val, out int error);
/// <summary>Returns the specified <see cref="T:System.Net.Sockets.Socket" /> option setting, represented as a byte array.</summary>
/// <param name="optionLevel">One of the <see cref="T:System.Net.Sockets.SocketOptionLevel" /> values. </param>
/// <param name="optionName">One of the <see cref="T:System.Net.Sockets.SocketOptionName" /> values. </param>
/// <param name="optionValue">An array of type <see cref="T:System.Byte" /> that is to receive the option setting. </param>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. - or -In .NET Compact Framework applications, the Windows CE default buffer space is set to 32768 bytes. You can change the per socket buffer space by calling <see cref="Overload:System.Net.Sockets.Socket.SetSocketOption" />.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06000FF3 RID: 4083 RVA: 0x0002D20C File Offset: 0x0002B40C
public void GetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, byte[] optionValue)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (optionValue == null)
{
throw new SocketException(10014, "Error trying to dereference an invalid pointer");
}
int num;
Socket.GetSocketOption_arr_internal(this.socket, optionLevel, optionName, ref optionValue, out num);
if (num != 0)
{
throw new SocketException(num);
}
}
/// <summary>Returns the value of the specified <see cref="T:System.Net.Sockets.Socket" /> option in an array.</summary>
/// <returns>An array of type <see cref="T:System.Byte" /> that contains the value of the socket option.</returns>
/// <param name="optionLevel">One of the <see cref="T:System.Net.Sockets.SocketOptionLevel" /> values. </param>
/// <param name="optionName">One of the <see cref="T:System.Net.Sockets.SocketOptionName" /> values. </param>
/// <param name="optionLength">The length, in bytes, of the expected return value. </param>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. - or -In .NET Compact Framework applications, the Windows CE default buffer space is set to 32768 bytes. You can change the per socket buffer space by calling <see cref="Overload:System.Net.Sockets.Socket.SetSocketOption" />.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06000FF4 RID: 4084 RVA: 0x0002D274 File Offset: 0x0002B474
public byte[] GetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, int length)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
byte[] array = new byte[length];
int num;
Socket.GetSocketOption_arr_internal(this.socket, optionLevel, optionName, ref array, out num);
if (num != 0)
{
throw new SocketException(num);
}
return array;
}
// Token: 0x06000FF5 RID: 4085
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int WSAIoctl(IntPtr sock, int ioctl_code, byte[] input, byte[] output, out int error);
/// <summary>Sets low-level operating modes for the <see cref="T:System.Net.Sockets.Socket" /> using numerical control codes.</summary>
/// <returns>The number of bytes in the <paramref name="optionOutValue" /> parameter.</returns>
/// <param name="ioControlCode">An <see cref="T:System.Int32" /> value that specifies the control code of the operation to perform. </param>
/// <param name="optionInValue">A <see cref="T:System.Byte" /> array that contains the input data required by the operation. </param>
/// <param name="optionOutValue">A <see cref="T:System.Byte" /> array that contains the output data returned by the operation. </param>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.InvalidOperationException">An attempt was made to change the blocking mode without using the <see cref="P:System.Net.Sockets.Socket.Blocking" /> property. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller in the call stack does not have the required permissions. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FF6 RID: 4086 RVA: 0x0002D2D0 File Offset: 0x0002B4D0
public int IOControl(int ioctl_code, byte[] in_value, byte[] out_value)
{
if (this.disposed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
int num2;
int num = Socket.WSAIoctl(this.socket, ioctl_code, in_value, out_value, out num2);
if (num2 != 0)
{
throw new SocketException(num2);
}
if (num == -1)
{
throw new InvalidOperationException("Must use Blocking property instead.");
}
return num;
}
/// <summary>Sets low-level operating modes for the <see cref="T:System.Net.Sockets.Socket" /> using the <see cref="T:System.Net.Sockets.IOControlCode" /> enumeration to specify control codes.</summary>
/// <returns>The number of bytes in the <paramref name="optionOutValue" /> parameter.</returns>
/// <param name="ioControlCode">A <see cref="T:System.Net.Sockets.IOControlCode" /> value that specifies the control code of the operation to perform. </param>
/// <param name="optionInValue">An array of type <see cref="T:System.Byte" /> that contains the input data required by the operation. </param>
/// <param name="optionOutValue">An array of type <see cref="T:System.Byte" /> that contains the output data returned by the operation. </param>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.InvalidOperationException">An attempt was made to change the blocking mode without using the <see cref="P:System.Net.Sockets.Socket.Blocking" /> property. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FF7 RID: 4087 RVA: 0x0002D32C File Offset: 0x0002B52C
[global::System.MonoTODO]
public int IOControl(IOControlCode ioControlCode, byte[] optionInValue, byte[] optionOutValue)
{
throw new NotImplementedException();
}
// Token: 0x06000FF8 RID: 4088
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Listen_internal(IntPtr sock, int backlog, out int error);
/// <summary>Places a <see cref="T:System.Net.Sockets.Socket" /> in a listening state.</summary>
/// <param name="backlog">The maximum length of the pending connections queue. </param>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06000FF9 RID: 4089 RVA: 0x0002D334 File Offset: 0x0002B534
public void Listen(int backlog)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (!this.isbound)
{
throw new SocketException(10022);
}
if (Environment.SocketSecurityEnabled)
{
SecurityException ex = new SecurityException("Listening on TCP sockets is not allowed in the webplayer");
Console.WriteLine("Throwing the following securityexception: " + ex);
throw ex;
}
int num;
Socket.Listen_internal(this.socket, backlog, out num);
if (num != 0)
{
throw new SocketException(num);
}
this.islistening = true;
}
/// <summary>Determines the status of the <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>The status of the <see cref="T:System.Net.Sockets.Socket" /> based on the polling mode value passed in the <paramref name="mode" /> parameter.Mode Return Value <see cref="F:System.Net.Sockets.SelectMode.SelectRead" />true if <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" /> has been called and a connection is pending; -or- true if data is available for reading; -or- true if the connection has been closed, reset, or terminated; otherwise, returns false. <see cref="F:System.Net.Sockets.SelectMode.SelectWrite" />true, if processing a <see cref="M:System.Net.Sockets.Socket.Connect(System.Net.EndPoint)" />, and the connection has succeeded; -or- true if data can be sent; otherwise, returns false. <see cref="F:System.Net.Sockets.SelectMode.SelectError" />true if processing a <see cref="M:System.Net.Sockets.Socket.Connect(System.Net.EndPoint)" /> that does not block, and the connection has failed; -or- true if <see cref="F:System.Net.Sockets.SocketOptionName.OutOfBandInline" /> is not set and out-of-band data is available; otherwise, returns false. </returns>
/// <param name="microSeconds">The time to wait for a response, in microseconds. </param>
/// <param name="mode">One of the <see cref="T:System.Net.Sockets.SelectMode" /> values. </param>
/// <exception cref="T:System.NotSupportedException">The <paramref name="mode" /> parameter is not one of the <see cref="T:System.Net.Sockets.SelectMode" /> values. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See remarks below. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06000FFA RID: 4090 RVA: 0x0002D3C8 File Offset: 0x0002B5C8
public bool Poll(int time_us, SelectMode mode)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (mode != SelectMode.SelectRead && mode != SelectMode.SelectWrite && mode != SelectMode.SelectError)
{
throw new NotSupportedException("'mode' parameter is not valid.");
}
int num;
bool flag = Socket.Poll_internal(this.socket, mode, time_us, out num);
if (num != 0)
{
throw new SocketException(num);
}
if (mode == SelectMode.SelectWrite && flag && !this.connected && (int)this.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error) == 0)
{
this.connected = true;
}
return flag;
}
/// <summary>Receives data from a bound <see cref="T:System.Net.Sockets.Socket" /> into a receive buffer.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for the received data. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller in the call stack does not have the required permissions. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FFB RID: 4091 RVA: 0x0002D474 File Offset: 0x0002B674
public int Receive(byte[] buffer)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
SocketError socketError;
int num = this.Receive_nochecks(buffer, 0, buffer.Length, SocketFlags.None, out socketError);
if (socketError != SocketError.Success)
{
throw new SocketException((int)socketError);
}
return num;
}
/// <summary>Receives data from a bound <see cref="T:System.Net.Sockets.Socket" /> into a receive buffer, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for the received data. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller in the call stack does not have the required permissions. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FFC RID: 4092 RVA: 0x0002D4D8 File Offset: 0x0002B6D8
public int Receive(byte[] buffer, SocketFlags flags)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
SocketError socketError;
int num = this.Receive_nochecks(buffer, 0, buffer.Length, flags, out socketError);
if (socketError == SocketError.Success)
{
return num;
}
if (socketError == SocketError.WouldBlock && this.blocking)
{
throw new SocketException((int)socketError, "Operation timed out.");
}
throw new SocketException((int)socketError);
}
/// <summary>Receives the specified number of bytes of data from a bound <see cref="T:System.Net.Sockets.Socket" /> into a receive buffer, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for the received data. </param>
/// <param name="size">The number of bytes to receive. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="size" /> exceeds the size of <paramref name="buffer" />. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller in the call stack does not have the required permissions. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FFD RID: 4093 RVA: 0x0002D55C File Offset: 0x0002B75C
public int Receive(byte[] buffer, int size, SocketFlags flags)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (size < 0 || size > buffer.Length)
{
throw new ArgumentOutOfRangeException("size");
}
SocketError socketError;
int num = this.Receive_nochecks(buffer, 0, size, flags, out socketError);
if (socketError == SocketError.Success)
{
return num;
}
if (socketError == SocketError.WouldBlock && this.blocking)
{
throw new SocketException((int)socketError, "Operation timed out.");
}
throw new SocketException((int)socketError);
}
/// <summary>Receives the specified number of bytes from a bound <see cref="T:System.Net.Sockets.Socket" /> into the specified offset position of the receive buffer, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for received data. </param>
/// <param name="offset">The location in <paramref name="buffer" /> to store the received data. </param>
/// <param name="size">The number of bytes to receive. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is greater than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">
/// <paramref name="socketFlags" /> is not a valid combination of values.-or- The <see cref="P:System.Net.Sockets.Socket.LocalEndPoint" /> property was not set.-or- An operating system error occurs while accessing the <see cref="T:System.Net.Sockets.Socket" />. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller in the call stack does not have the required permissions. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06000FFE RID: 4094 RVA: 0x0002D5FC File Offset: 0x0002B7FC
public int Receive(byte[] buffer, int offset, int size, SocketFlags flags)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (offset < 0 || offset > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset");
}
if (size < 0 || offset + size > buffer.Length)
{
throw new ArgumentOutOfRangeException("size");
}
SocketError socketError;
int num = this.Receive_nochecks(buffer, offset, size, flags, out socketError);
if (socketError == SocketError.Success)
{
return num;
}
if (socketError == SocketError.WouldBlock && this.blocking)
{
throw new SocketException((int)socketError, "Operation timed out.");
}
throw new SocketException((int)socketError);
}
/// <summary>Receives data from a bound <see cref="T:System.Net.Sockets.Socket" /> into a receive buffer, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for the received data.</param>
/// <param name="offset">The position in the <paramref name="buffer" /> parameter to store the received data. </param>
/// <param name="size">The number of bytes to receive. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values.</param>
/// <param name="errorCode">A <see cref="T:System.Net.Sockets.SocketError" /> object that stores the socket error.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is greater than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">
/// <paramref name="socketFlags" /> is not a valid combination of values.-or- The <see cref="P:System.Net.Sockets.Socket.LocalEndPoint" /> property is not set.-or- An operating system error occurs while accessing the <see cref="T:System.Net.Sockets.Socket" />. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller in the call stack does not have the required permissions. </exception>
// Token: 0x06000FFF RID: 4095 RVA: 0x0002D6B8 File Offset: 0x0002B8B8
public int Receive(byte[] buffer, int offset, int size, SocketFlags flags, out SocketError error)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (offset < 0 || offset > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset");
}
if (size < 0 || offset + size > buffer.Length)
{
throw new ArgumentOutOfRangeException("size");
}
return this.Receive_nochecks(buffer, offset, size, flags, out error);
}
// Token: 0x06001000 RID: 4096
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int Receive_internal(IntPtr sock, Socket.WSABUF[] bufarray, SocketFlags flags, out int error);
/// <summary>Receives data from a bound <see cref="T:System.Net.Sockets.Socket" /> into the list of receive buffers.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffers">A list of <see cref="T:System.ArraySegment`1" />s of type <see cref="T:System.Byte" /> that contains the received data.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="buffer" /> parameter is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred while attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06001001 RID: 4097 RVA: 0x0002D744 File Offset: 0x0002B944
public int Receive(IList<ArraySegment<byte>> buffers)
{
SocketError socketError;
int num = this.Receive(buffers, SocketFlags.None, out socketError);
if (socketError != SocketError.Success)
{
throw new SocketException((int)socketError);
}
return num;
}
/// <summary>Receives data from a bound <see cref="T:System.Net.Sockets.Socket" /> into the list of receive buffers, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffers">A list of <see cref="T:System.ArraySegment`1" />s of type <see cref="T:System.Byte" /> that contains the received data.</param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffers" /> is null.-or-<paramref name="buffers" />.Count is zero.</exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred while attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06001002 RID: 4098 RVA: 0x0002D76C File Offset: 0x0002B96C
[CLSCompliant(false)]
public int Receive(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags)
{
SocketError socketError;
int num = this.Receive(buffers, socketFlags, out socketError);
if (socketError != SocketError.Success)
{
throw new SocketException((int)socketError);
}
return num;
}
/// <summary>Receives data from a bound <see cref="T:System.Net.Sockets.Socket" /> into the list of receive buffers, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffers">A list of <see cref="T:System.ArraySegment`1" />s of type <see cref="T:System.Byte" /> that contains the received data.</param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values.</param>
/// <param name="errorCode">A <see cref="T:System.Net.Sockets.SocketError" /> object that stores the socket error.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffers" /> is null.-or-<paramref name="buffers" />.Count is zero.</exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred while attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06001003 RID: 4099 RVA: 0x0002D794 File Offset: 0x0002B994
[CLSCompliant(false)]
public int Receive(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffers == null || buffers.Count == 0)
{
throw new ArgumentNullException("buffers");
}
int count = buffers.Count;
Socket.WSABUF[] array = new Socket.WSABUF[count];
GCHandle[] array2 = new GCHandle[count];
for (int i = 0; i < count; i++)
{
ArraySegment<byte> arraySegment = buffers[i];
array2[i] = GCHandle.Alloc(arraySegment.Array, GCHandleType.Pinned);
array[i].len = arraySegment.Count;
array[i].buf = Marshal.UnsafeAddrOfPinnedArrayElement(arraySegment.Array, arraySegment.Offset);
}
int num2;
int num;
try
{
num = Socket.Receive_internal(this.socket, array, socketFlags, out num2);
}
finally
{
for (int j = 0; j < count; j++)
{
if (array2[j].IsAllocated)
{
array2[j].Free();
}
}
}
errorCode = (SocketError)num2;
return num;
}
/// <summary>Begins to asynchronously receive data from a specified network device.</summary>
/// <returns>Returns true if the I/O operation is pending. The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will be raised upon completion of the operation. Returns false if the I/O operation completed synchronously. In this case, The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will not be raised and the <paramref name="e" /> object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.</returns>
/// <param name="e">The <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object to use for this asynchronous socket operation.</param>
/// <exception cref="T:System.ArgumentNullException">The <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.RemoteEndPoint" /> cannot be null.</exception>
/// <exception cref="T:System.InvalidOperationException">A socket operation was already in progress using the <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object specified in the <paramref name="e" /> parameter.</exception>
/// <exception cref="T:System.NotSupportedException">Windows XP or later is required for this method.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. </exception>
// Token: 0x06001004 RID: 4100 RVA: 0x0002D8D8 File Offset: 0x0002BAD8
public bool ReceiveFromAsync(SocketAsyncEventArgs e)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (e.BufferList != null)
{
throw new NotSupportedException("Mono doesn't support using BufferList at this point.");
}
if (e.RemoteEndPoint == null)
{
throw new ArgumentNullException("remoteEP", "Value cannot be null.");
}
e.DoOperation(SocketAsyncOperation.ReceiveFrom, this);
return true;
}
/// <summary>Receives a datagram into the data buffer and stores the endpoint.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for received data. </param>
/// <param name="remoteEP">An <see cref="T:System.Net.EndPoint" />, passed by reference, that represents the remote server. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null.-or- <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller in the call stack does not have the required permissions. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001005 RID: 4101 RVA: 0x0002D948 File Offset: 0x0002BB48
public int ReceiveFrom(byte[] buffer, ref EndPoint remoteEP)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (remoteEP == null)
{
throw new ArgumentNullException("remoteEP");
}
return this.ReceiveFrom_nochecks(buffer, 0, buffer.Length, SocketFlags.None, ref remoteEP);
}
/// <summary>Receives a datagram into the data buffer, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />, and stores the endpoint.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for the received data. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="remoteEP">An <see cref="T:System.Net.EndPoint" />, passed by reference, that represents the remote server. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null.-or- <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller in the call stack does not have the required permissions. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001006 RID: 4102 RVA: 0x0002D9AC File Offset: 0x0002BBAC
public int ReceiveFrom(byte[] buffer, SocketFlags flags, ref EndPoint remoteEP)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (remoteEP == null)
{
throw new ArgumentNullException("remoteEP");
}
return this.ReceiveFrom_nochecks(buffer, 0, buffer.Length, flags, ref remoteEP);
}
/// <summary>Receives the specified number of bytes into the data buffer, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />, and stores the endpoint.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for received data. </param>
/// <param name="size">The number of bytes to receive. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="remoteEP">An <see cref="T:System.Net.EndPoint" />, passed by reference, that represents the remote server. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null.-or- <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" />. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">
/// <paramref name="socketFlags" /> is not a valid combination of values.-or- The <see cref="P:System.Net.Sockets.Socket.LocalEndPoint" /> property was not set.-or- An operating system error occurs while accessing the <see cref="T:System.Net.Sockets.Socket" />. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller in the call stack does not have the required permissions. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001007 RID: 4103 RVA: 0x0002DA10 File Offset: 0x0002BC10
public int ReceiveFrom(byte[] buffer, int size, SocketFlags flags, ref EndPoint remoteEP)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (remoteEP == null)
{
throw new ArgumentNullException("remoteEP");
}
if (size < 0 || size > buffer.Length)
{
throw new ArgumentOutOfRangeException("size");
}
return this.ReceiveFrom_nochecks(buffer, 0, size, flags, ref remoteEP);
}
// Token: 0x06001008 RID: 4104
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int RecvFrom_internal(IntPtr sock, byte[] buffer, int offset, int count, SocketFlags flags, ref SocketAddress sockaddr, out int error);
/// <summary>Receives the specified number of bytes of data into the specified location of the data buffer, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />, and stores the endpoint.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for received data. </param>
/// <param name="offset">The position in the <paramref name="buffer" /> parameter to store the received data. </param>
/// <param name="size">The number of bytes to receive. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="remoteEP">An <see cref="T:System.Net.EndPoint" />, passed by reference, that represents the remote server. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null.-or- <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is greater than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of the <paramref name="buffer" /> minus the value of the offset parameter. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">
/// <paramref name="socketFlags" /> is not a valid combination of values.-or- The <see cref="P:System.Net.Sockets.Socket.LocalEndPoint" /> property was not set.-or- An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001009 RID: 4105 RVA: 0x0002DA90 File Offset: 0x0002BC90
public int ReceiveFrom(byte[] buffer, int offset, int size, SocketFlags flags, ref EndPoint remoteEP)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (remoteEP == null)
{
throw new ArgumentNullException("remoteEP");
}
if (offset < 0 || offset > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset");
}
if (size < 0 || offset + size > buffer.Length)
{
throw new ArgumentOutOfRangeException("size");
}
return this.ReceiveFrom_nochecks(buffer, offset, size, flags, ref remoteEP);
}
// Token: 0x0600100A RID: 4106 RVA: 0x0002DB30 File Offset: 0x0002BD30
internal int ReceiveFrom_nochecks(byte[] buf, int offset, int size, SocketFlags flags, ref EndPoint remote_end)
{
int num;
return this.ReceiveFrom_nochecks_exc(buf, offset, size, flags, ref remote_end, true, out num);
}
// Token: 0x0600100B RID: 4107 RVA: 0x0002DB50 File Offset: 0x0002BD50
internal int ReceiveFrom_nochecks_exc(byte[] buf, int offset, int size, SocketFlags flags, ref EndPoint remote_end, bool throwOnError, out int error)
{
SocketAddress socketAddress = remote_end.Serialize();
int num = Socket.RecvFrom_internal(this.socket, buf, offset, size, flags, ref socketAddress, out error);
SocketError socketError = (SocketError)error;
if (socketError != SocketError.Success)
{
if (socketError != SocketError.WouldBlock && socketError != SocketError.InProgress)
{
this.connected = false;
}
else if (socketError == SocketError.WouldBlock && this.blocking)
{
if (throwOnError)
{
throw new SocketException(10060, "Operation timed out");
}
error = 10060;
return 0;
}
if (throwOnError)
{
throw new SocketException(error);
}
return 0;
}
else
{
if (Environment.SocketSecurityEnabled && !Socket.CheckEndPoint(socketAddress))
{
buf.Initialize();
throw new SecurityException("Unable to connect, as no valid crossdomain policy was found");
}
this.connected = true;
this.isbound = true;
if (socketAddress != null)
{
remote_end = remote_end.Create(socketAddress);
}
this.seed_endpoint = remote_end;
return num;
}
}
/// <summary>Begins to asynchronously receive the specified number of bytes of data into the specified location in the data buffer, using the specified <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.SocketFlags" />, and stores the endpoint and packet information.</summary>
/// <returns>Returns true if the I/O operation is pending. The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will be raised upon completion of the operation. Returns false if the I/O operation completed synchronously. In this case, The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will not be raised and the <paramref name="e" /> object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.</returns>
/// <param name="e">The <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object to use for this asynchronous socket operation.</param>
/// <exception cref="T:System.ArgumentNullException">The <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.RemoteEndPoint" /> cannot be null.</exception>
/// <exception cref="T:System.NotSupportedException">Windows XP or later is required for this method.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. </exception>
// Token: 0x0600100C RID: 4108 RVA: 0x0002DC40 File Offset: 0x0002BE40
[global::System.MonoTODO("Not implemented")]
public bool ReceiveMessageFromAsync(SocketAsyncEventArgs e)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
throw new NotImplementedException();
}
/// <summary>Receives the specified number of bytes of data into the specified location of the data buffer, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />, and stores the endpoint and packet information.</summary>
/// <returns>The number of bytes received.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that is the storage location for received data.</param>
/// <param name="offset">The position in the <paramref name="buffer" /> parameter to store the received data.</param>
/// <param name="size">The number of bytes to receive.</param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values.</param>
/// <param name="remoteEP">An <see cref="T:System.Net.EndPoint" />, passed by reference, that represents the remote server.</param>
/// <param name="ipPacketInformation">An <see cref="T:System.Net.Sockets.IPPacketInformation" /> holding address and interface information.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null.- or- <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is greater than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of the <paramref name="buffer" /> minus the value of the offset parameter. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">
/// <paramref name="socketFlags" /> is not a valid combination of values.-or- The <see cref="P:System.Net.Sockets.Socket.LocalEndPoint" /> property was not set.-or- The .NET Framework is running on an AMD 64-bit processor.-or- An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.NotSupportedException">The operating system is Windows 2000 or earlier, and this method requires Windows XP.</exception>
// Token: 0x0600100D RID: 4109 RVA: 0x0002DC7C File Offset: 0x0002BE7C
[global::System.MonoTODO("Not implemented")]
public int ReceiveMessageFrom(byte[] buffer, int offset, int size, ref SocketFlags socketFlags, ref EndPoint remoteEP, out IPPacketInformation ipPacketInformation)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (remoteEP == null)
{
throw new ArgumentNullException("remoteEP");
}
if (offset < 0 || offset > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset");
}
if (size < 0 || offset + size > buffer.Length)
{
throw new ArgumentOutOfRangeException("size");
}
throw new NotImplementedException();
}
/// <summary>Sends a collection of files or in memory data buffers asynchronously to a connected <see cref="T:System.Net.Sockets.Socket" /> object.</summary>
/// <returns>Returns true if the I/O operation is pending. The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will be raised upon completion of the operation. Returns false if the I/O operation completed synchronously. In this case, The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will not be raised and the <paramref name="e" /> object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.</returns>
/// <param name="e">The <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object to use for this asynchronous socket operation.</param>
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in the <see cref="P:System.Net.Sockets.SendPacketsElement.FilePath" /> property was not found. </exception>
/// <exception cref="T:System.InvalidOperationException">A socket operation was already in progress using the <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object specified in the <paramref name="e" /> parameter.</exception>
/// <exception cref="T:System.NotSupportedException">Windows XP or later is required for this method. This exception also occurs if the <see cref="T:System.Net.Sockets.Socket" /> is not connected to a remote host. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">A connectionless <see cref="T:System.Net.Sockets.Socket" /> is being used and the file being sent exceeds the maximum packet size of the underlying transport.</exception>
// Token: 0x0600100E RID: 4110 RVA: 0x0002DD14 File Offset: 0x0002BF14
[global::System.MonoTODO("Not implemented")]
public bool SendPacketsAsync(SocketAsyncEventArgs e)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
throw new NotImplementedException();
}
/// <summary>Sends data to a connected <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>The number of bytes sent to the <see cref="T:System.Net.Sockets.Socket" />.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the data to be sent. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600100F RID: 4111 RVA: 0x0002DD50 File Offset: 0x0002BF50
public int Send(byte[] buf)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buf == null)
{
throw new ArgumentNullException("buf");
}
SocketError socketError;
int num = this.Send_nochecks(buf, 0, buf.Length, SocketFlags.None, out socketError);
if (socketError != SocketError.Success)
{
throw new SocketException((int)socketError);
}
return num;
}
/// <summary>Sends data to a connected <see cref="T:System.Net.Sockets.Socket" /> using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes sent to the <see cref="T:System.Net.Sockets.Socket" />.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the data to be sent. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001010 RID: 4112 RVA: 0x0002DDB4 File Offset: 0x0002BFB4
public int Send(byte[] buf, SocketFlags flags)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buf == null)
{
throw new ArgumentNullException("buf");
}
SocketError socketError;
int num = this.Send_nochecks(buf, 0, buf.Length, flags, out socketError);
if (socketError != SocketError.Success)
{
throw new SocketException((int)socketError);
}
return num;
}
/// <summary>Sends the specified number of bytes of data to a connected <see cref="T:System.Net.Sockets.Socket" />, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes sent to the <see cref="T:System.Net.Sockets.Socket" />.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the data to be sent. </param>
/// <param name="size">The number of bytes to send. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="size" /> is less than 0 or exceeds the size of the buffer. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">
/// <paramref name="socketFlags" /> is not a valid combination of values.-or- An operating system error occurs while accessing the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001011 RID: 4113 RVA: 0x0002DE18 File Offset: 0x0002C018
public int Send(byte[] buf, int size, SocketFlags flags)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buf == null)
{
throw new ArgumentNullException("buf");
}
if (size < 0 || size > buf.Length)
{
throw new ArgumentOutOfRangeException("size");
}
SocketError socketError;
int num = this.Send_nochecks(buf, 0, size, flags, out socketError);
if (socketError != SocketError.Success)
{
throw new SocketException((int)socketError);
}
return num;
}
/// <summary>Sends the specified number of bytes of data to a connected <see cref="T:System.Net.Sockets.Socket" />, starting at the specified offset, and using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes sent to the <see cref="T:System.Net.Sockets.Socket" />.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the data to be sent. </param>
/// <param name="offset">The position in the data buffer at which to begin sending data. </param>
/// <param name="size">The number of bytes to send. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is greater than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">
/// <paramref name="socketFlags" /> is not a valid combination of values.-or- An operating system error occurs while accessing the <see cref="T:System.Net.Sockets.Socket" />. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001012 RID: 4114 RVA: 0x0002DE94 File Offset: 0x0002C094
public int Send(byte[] buf, int offset, int size, SocketFlags flags)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
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");
}
SocketError socketError;
int num = this.Send_nochecks(buf, offset, size, flags, out socketError);
if (socketError != SocketError.Success)
{
throw new SocketException((int)socketError);
}
return num;
}
/// <summary>Sends the specified number of bytes of data to a connected <see cref="T:System.Net.Sockets.Socket" />, starting at the specified offset, and using the specified <see cref="T:System.Net.Sockets.SocketFlags" /></summary>
/// <returns>The number of bytes sent to the <see cref="T:System.Net.Sockets.Socket" />.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the data to be sent. </param>
/// <param name="offset">The position in the data buffer at which to begin sending data. </param>
/// <param name="size">The number of bytes to send. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="errorCode">A <see cref="T:System.Net.Sockets.SocketError" /> object that stores the socket error.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is greater than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">
/// <paramref name="socketFlags" /> is not a valid combination of values.-or- An operating system error occurs while accessing the <see cref="T:System.Net.Sockets.Socket" />. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06001013 RID: 4115 RVA: 0x0002DF30 File Offset: 0x0002C130
public int Send(byte[] buf, int offset, int size, SocketFlags flags, out SocketError error)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
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");
}
return this.Send_nochecks(buf, offset, size, flags, out error);
}
// Token: 0x06001014 RID: 4116
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int Send_internal(IntPtr sock, Socket.WSABUF[] bufarray, SocketFlags flags, out int error);
/// <summary>Sends the set of buffers in the list to a connected <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>The number of bytes sent to the <see cref="T:System.Net.Sockets.Socket" />.</returns>
/// <param name="buffers">A list of <see cref="T:System.ArraySegment`1" />s of type <see cref="T:System.Byte" /> that contains the data to be sent. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffers" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="buffers" /> is empty.</exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See remarks section below. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06001015 RID: 4117 RVA: 0x0002DFBC File Offset: 0x0002C1BC
public int Send(IList<ArraySegment<byte>> buffers)
{
SocketError socketError;
int num = this.Send(buffers, SocketFlags.None, out socketError);
if (socketError != SocketError.Success)
{
throw new SocketException((int)socketError);
}
return num;
}
/// <summary>Sends the set of buffers in the list to a connected <see cref="T:System.Net.Sockets.Socket" />, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes sent to the <see cref="T:System.Net.Sockets.Socket" />.</returns>
/// <param name="buffers">A list of <see cref="T:System.ArraySegment`1" />s of type <see cref="T:System.Byte" /> that contains the data to be sent.</param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffers" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="buffers" /> is empty.</exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06001016 RID: 4118 RVA: 0x0002DFE4 File Offset: 0x0002C1E4
public int Send(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags)
{
SocketError socketError;
int num = this.Send(buffers, socketFlags, out socketError);
if (socketError != SocketError.Success)
{
throw new SocketException((int)socketError);
}
return num;
}
/// <summary>Sends the set of buffers in the list to a connected <see cref="T:System.Net.Sockets.Socket" />, using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes sent to the <see cref="T:System.Net.Sockets.Socket" />.</returns>
/// <param name="buffers">A list of <see cref="T:System.ArraySegment`1" />s of type <see cref="T:System.Byte" /> that contains the data to be sent.</param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values.</param>
/// <param name="errorCode">A <see cref="T:System.Net.Sockets.SocketError" /> object that stores the socket error.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffers" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="buffers" /> is empty.</exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
// Token: 0x06001017 RID: 4119 RVA: 0x0002E00C File Offset: 0x0002C20C
[CLSCompliant(false)]
public int Send(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffers == null)
{
throw new ArgumentNullException("buffers");
}
if (buffers.Count == 0)
{
throw new ArgumentException("Buffer is empty", "buffers");
}
int count = buffers.Count;
Socket.WSABUF[] array = new Socket.WSABUF[count];
GCHandle[] array2 = new GCHandle[count];
for (int i = 0; i < count; i++)
{
ArraySegment<byte> arraySegment = buffers[i];
array2[i] = GCHandle.Alloc(arraySegment.Array, GCHandleType.Pinned);
array[i].len = arraySegment.Count;
array[i].buf = Marshal.UnsafeAddrOfPinnedArrayElement(arraySegment.Array, arraySegment.Offset);
}
int num2;
int num;
try
{
num = Socket.Send_internal(this.socket, array, socketFlags, out num2);
}
finally
{
for (int j = 0; j < count; j++)
{
if (array2[j].IsAllocated)
{
array2[j].Free();
}
}
}
errorCode = (SocketError)num2;
return num;
}
// Token: 0x06001018 RID: 4120
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool SendFile(IntPtr sock, string filename, byte[] pre_buffer, byte[] post_buffer, TransmitFileOptions flags);
/// <summary>Sends the file <paramref name="fileName" /> to a connected <see cref="T:System.Net.Sockets.Socket" /> object with the <see cref="F:System.Net.Sockets.TransmitFileOptions.UseDefaultWorkerThread" /> transmit flag.</summary>
/// <param name="fileName">A <see cref="T:System.String" /> that contains the path and name of the file to be sent. This parameter can be null. </param>
/// <exception cref="T:System.NotSupportedException">The socket is not connected to a remote host. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Net.Sockets.Socket" /> object is not in blocking mode and cannot accept this synchronous call. </exception>
/// <exception cref="T:System.IO.FileNotFoundException">The file <paramref name="fileName" /> was not found. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001019 RID: 4121 RVA: 0x0002E160 File Offset: 0x0002C360
public void SendFile(string fileName)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (!this.connected)
{
throw new NotSupportedException();
}
if (!this.blocking)
{
throw new InvalidOperationException();
}
this.SendFile(fileName, null, null, TransmitFileOptions.UseDefaultWorkerThread);
}
/// <summary>Sends the file <paramref name="fileName" /> and buffers of data to a connected <see cref="T:System.Net.Sockets.Socket" /> object using the specified <see cref="T:System.Net.Sockets.TransmitFileOptions" /> value.</summary>
/// <param name="fileName">A <see cref="T:System.String" /> that contains the path and name of the file to be sent. This parameter can be null. </param>
/// <param name="preBuffer">A <see cref="T:System.Byte" /> array that contains data to be sent before the file is sent. This parameter can be null. </param>
/// <param name="postBuffer">A <see cref="T:System.Byte" /> array that contains data to be sent after the file is sent. This parameter can be null. </param>
/// <param name="flags">One or more of <see cref="T:System.Net.Sockets.TransmitFileOptions" /> values. </param>
/// <exception cref="T:System.NotSupportedException">The operating system is not Windows NT or later.- or - The socket is not connected to a remote host. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Net.Sockets.Socket" /> object is not in blocking mode and cannot accept this synchronous call. </exception>
/// <exception cref="T:System.IO.FileNotFoundException">The file <paramref name="fileName" /> was not found. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
// Token: 0x0600101A RID: 4122 RVA: 0x0002E1C0 File Offset: 0x0002C3C0
public void SendFile(string fileName, byte[] preBuffer, byte[] postBuffer, TransmitFileOptions flags)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (!this.connected)
{
throw new NotSupportedException();
}
if (!this.blocking)
{
throw new InvalidOperationException();
}
if (Socket.SendFile(this.socket, fileName, preBuffer, postBuffer, flags))
{
return;
}
SocketException ex = new SocketException();
if (ex.ErrorCode == 2 || ex.ErrorCode == 3)
{
throw new FileNotFoundException();
}
throw ex;
}
/// <summary>Sends data asynchronously to a specific remote host.</summary>
/// <returns>Returns true if the I/O operation is pending. The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will be raised upon completion of the operation. Returns false if the I/O operation completed synchronously. In this case, The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will not be raised and the <paramref name="e" /> object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.</returns>
/// <param name="e">The <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object to use for this asynchronous socket operation.</param>
/// <exception cref="T:System.ArgumentNullException">The <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.RemoteEndPoint" /> cannot be null.</exception>
/// <exception cref="T:System.InvalidOperationException">A socket operation was already in progress using the <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object specified in the <paramref name="e" /> parameter.</exception>
/// <exception cref="T:System.NotSupportedException">Windows XP or later is required for this method.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">The protocol specified is connection-oriented, but the <see cref="T:System.Net.Sockets.Socket" /> is not yet connected.</exception>
// Token: 0x0600101B RID: 4123 RVA: 0x0002E254 File Offset: 0x0002C454
public bool SendToAsync(SocketAsyncEventArgs e)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (e.RemoteEndPoint == null)
{
throw new ArgumentNullException("remoteEP", "Value cannot be null.");
}
e.DoOperation(SocketAsyncOperation.SendTo, this);
return true;
}
/// <summary>Sends data to the specified endpoint.</summary>
/// <returns>The number of bytes sent.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the data to be sent. </param>
/// <param name="remoteEP">The <see cref="T:System.Net.EndPoint" /> that represents the destination for the data. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null.-or- <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600101C RID: 4124 RVA: 0x0002E2B0 File Offset: 0x0002C4B0
public int SendTo(byte[] buffer, EndPoint remote_end)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (remote_end == null)
{
throw new ArgumentNullException("remote_end");
}
return this.SendTo_nochecks(buffer, 0, buffer.Length, SocketFlags.None, remote_end);
}
/// <summary>Sends data to a specific endpoint using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes sent.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the data to be sent. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="remoteEP">The <see cref="T:System.Net.EndPoint" /> that represents the destination location for the data. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null.-or- <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600101D RID: 4125 RVA: 0x0002E314 File Offset: 0x0002C514
public int SendTo(byte[] buffer, SocketFlags flags, EndPoint remote_end)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (remote_end == null)
{
throw new ArgumentNullException("remote_end");
}
return this.SendTo_nochecks(buffer, 0, buffer.Length, flags, remote_end);
}
/// <summary>Sends the specified number of bytes of data to the specified endpoint using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes sent.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the data to be sent. </param>
/// <param name="size">The number of bytes to send. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="remoteEP">The <see cref="T:System.Net.EndPoint" /> that represents the destination location for the data. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null.-or- <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The specified <paramref name="size" /> exceeds the size of <paramref name="buffer" />. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x0600101E RID: 4126 RVA: 0x0002E378 File Offset: 0x0002C578
public int SendTo(byte[] buffer, int size, SocketFlags flags, EndPoint remote_end)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (remote_end == null)
{
throw new ArgumentNullException("remote_end");
}
if (size < 0 || size > buffer.Length)
{
throw new ArgumentOutOfRangeException("size");
}
return this.SendTo_nochecks(buffer, 0, size, flags, remote_end);
}
// Token: 0x0600101F RID: 4127
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int SendTo_internal_real(IntPtr sock, byte[] buffer, int offset, int count, SocketFlags flags, SocketAddress sa, out int error);
// Token: 0x06001020 RID: 4128 RVA: 0x0002E3F8 File Offset: 0x0002C5F8
private static int SendTo_internal(IntPtr sock, byte[] buffer, int offset, int count, SocketFlags flags, SocketAddress sa, out int error)
{
if (Environment.SocketSecurityEnabled && !Socket.CheckEndPoint(sa))
{
SecurityException ex = new SecurityException("SendTo request refused by Unity webplayer security model");
Console.WriteLine("Throwing the following security exception: " + ex);
throw ex;
}
return Socket.SendTo_internal_real(sock, buffer, offset, count, flags, sa, out error);
}
/// <summary>Sends the specified number of bytes of data to the specified endpoint, starting at the specified location in the buffer, and using the specified <see cref="T:System.Net.Sockets.SocketFlags" />.</summary>
/// <returns>The number of bytes sent.</returns>
/// <param name="buffer">An array of type <see cref="T:System.Byte" /> that contains the data to be sent. </param>
/// <param name="offset">The position in the data buffer at which to begin sending data. </param>
/// <param name="size">The number of bytes to send. </param>
/// <param name="socketFlags">A bitwise combination of the <see cref="T:System.Net.Sockets.SocketFlags" /> values. </param>
/// <param name="remoteEP">The <see cref="T:System.Net.EndPoint" /> that represents the destination location for the data. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="buffer" /> is null.-or- <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="offset" /> is less than 0.-or- <paramref name="offset" /> is greater than the length of <paramref name="buffer" />.-or- <paramref name="size" /> is less than 0.-or- <paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">
/// <paramref name="socketFlags" /> is not a valid combination of values.-or- An operating system error occurs while accessing the <see cref="T:System.Net.Sockets.Socket" />. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller in the call stack does not have the required permissions. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001021 RID: 4129 RVA: 0x0002E44C File Offset: 0x0002C64C
public int SendTo(byte[] buffer, int offset, int size, SocketFlags flags, EndPoint remote_end)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (remote_end == null)
{
throw new ArgumentNullException("remote_end");
}
if (offset < 0 || offset > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset");
}
if (size < 0 || offset + size > buffer.Length)
{
throw new ArgumentOutOfRangeException("size");
}
return this.SendTo_nochecks(buffer, offset, size, flags, remote_end);
}
// Token: 0x06001022 RID: 4130 RVA: 0x0002E4E8 File Offset: 0x0002C6E8
internal int SendTo_nochecks(byte[] buffer, int offset, int size, SocketFlags flags, EndPoint remote_end)
{
SocketAddress socketAddress = remote_end.Serialize();
int num2;
int num = Socket.SendTo_internal(this.socket, buffer, offset, size, flags, socketAddress, out num2);
SocketError socketError = (SocketError)num2;
if (socketError != SocketError.Success)
{
if (socketError != SocketError.WouldBlock && socketError != SocketError.InProgress)
{
this.connected = false;
}
throw new SocketException(num2);
}
this.connected = true;
this.isbound = true;
this.seed_endpoint = remote_end;
return num;
}
/// <summary>Sets the specified <see cref="T:System.Net.Sockets.Socket" /> option to the specified value, represented as a byte array.</summary>
/// <param name="optionLevel">One of the <see cref="T:System.Net.Sockets.SocketOptionLevel" /> values. </param>
/// <param name="optionName">One of the <see cref="T:System.Net.Sockets.SocketOptionName" /> values. </param>
/// <param name="optionValue">An array of type <see cref="T:System.Byte" /> that represents the value of the option. </param>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001023 RID: 4131 RVA: 0x0002E554 File Offset: 0x0002C754
public void SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, byte[] optionValue)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (optionValue == null)
{
throw new SocketException(10014, "Error trying to dereference an invalid pointer");
}
int num;
Socket.SetSocketOption_internal(this.socket, optionLevel, optionName, null, optionValue, 0, out num);
if (num == 0)
{
return;
}
if (num == 10022)
{
throw new ArgumentException();
}
throw new SocketException(num);
}
/// <summary>Sets the specified <see cref="T:System.Net.Sockets.Socket" /> option to the specified value, represented as an object.</summary>
/// <param name="optionLevel">One of the <see cref="T:System.Net.Sockets.SocketOptionLevel" /> values. </param>
/// <param name="optionName">One of the <see cref="T:System.Net.Sockets.SocketOptionName" /> values. </param>
/// <param name="optionValue">A <see cref="T:System.Net.Sockets.LingerOption" /> or <see cref="T:System.Net.Sockets.MulticastOption" /> that contains the value of the option. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="optionValue" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001024 RID: 4132 RVA: 0x0002E5D0 File Offset: 0x0002C7D0
public void SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, object optionValue)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (optionValue == null)
{
throw new ArgumentNullException("optionValue");
}
int num;
if (optionLevel == SocketOptionLevel.Socket && optionName == SocketOptionName.Linger)
{
LingerOption lingerOption = optionValue as LingerOption;
if (lingerOption == null)
{
throw new ArgumentException("A 'LingerOption' value must be specified.", "optionValue");
}
Socket.SetSocketOption_internal(this.socket, optionLevel, optionName, lingerOption, null, 0, out num);
}
else if (optionLevel == SocketOptionLevel.IP && (optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership))
{
MulticastOption multicastOption = optionValue as MulticastOption;
if (multicastOption == null)
{
throw new ArgumentException("A 'MulticastOption' value must be specified.", "optionValue");
}
Socket.SetSocketOption_internal(this.socket, optionLevel, optionName, multicastOption, null, 0, out num);
}
else
{
if (optionLevel != SocketOptionLevel.IPv6 || (optionName != SocketOptionName.AddMembership && optionName != SocketOptionName.DropMembership))
{
throw new ArgumentException("Invalid value specified.", "optionValue");
}
IPv6MulticastOption pv6MulticastOption = optionValue as IPv6MulticastOption;
if (pv6MulticastOption == null)
{
throw new ArgumentException("A 'IPv6MulticastOption' value must be specified.", "optionValue");
}
Socket.SetSocketOption_internal(this.socket, optionLevel, optionName, pv6MulticastOption, null, 0, out num);
}
if (num == 0)
{
return;
}
if (num == 10022)
{
throw new ArgumentException();
}
throw new SocketException(num);
}
/// <summary>Sets the specified <see cref="T:System.Net.Sockets.Socket" /> option to the specified <see cref="T:System.Boolean" /> value.</summary>
/// <param name="optionLevel">One of the <see cref="T:System.Net.Sockets.SocketOptionLevel" /> values. </param>
/// <param name="optionName">One of the <see cref="T:System.Net.Sockets.SocketOptionName" /> values. </param>
/// <param name="optionValue">The value of the option, represented as a <see cref="T:System.Boolean" />. </param>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> object has been closed. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001025 RID: 4133 RVA: 0x0002E724 File Offset: 0x0002C924
public void SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, bool optionValue)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
int num = ((!optionValue) ? 0 : 1);
int num2;
Socket.SetSocketOption_internal(this.socket, optionLevel, optionName, null, null, num, out num2);
if (num2 == 0)
{
return;
}
if (num2 == 10022)
{
throw new ArgumentException();
}
throw new SocketException(num2);
}
// Token: 0x06001026 RID: 4134 RVA: 0x0002E798 File Offset: 0x0002C998
internal static void CheckProtocolSupport()
{
if (Socket.ipv4Supported == -1)
{
try
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Close();
Socket.ipv4Supported = 1;
}
catch
{
Socket.ipv4Supported = 0;
}
}
if (Socket.ipv6Supported == -1 && Socket.ipv6Supported != 0)
{
try
{
Socket socket2 = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
socket2.Close();
Socket.ipv6Supported = 1;
}
catch
{
Socket.ipv6Supported = 0;
}
}
}
/// <summary>Gets a value indicating whether IPv4 support is available and enabled on the current host.</summary>
/// <returns>true if the current host supports the IPv4 protocol; otherwise, false.</returns>
// Token: 0x17000565 RID: 1381
// (get) Token: 0x06001027 RID: 4135 RVA: 0x0002E848 File Offset: 0x0002CA48
public static bool SupportsIPv4
{
get
{
Socket.CheckProtocolSupport();
return Socket.ipv4Supported == 1;
}
}
/// <summary>Gets a value that indicates whether the Framework supports IPv6 for certain obsolete <see cref="T:System.Net.Dns" /> members.</summary>
/// <returns>true if the Framework supports IPv6 for certain obsolete <see cref="T:System.Net.Dns" /> methods; otherwise, false.</returns>
// Token: 0x17000566 RID: 1382
// (get) Token: 0x06001028 RID: 4136 RVA: 0x0002E858 File Offset: 0x0002CA58
[Obsolete("Use OSSupportsIPv6 instead")]
public static bool SupportsIPv6
{
get
{
Socket.CheckProtocolSupport();
return Socket.ipv6Supported == 1;
}
}
// Token: 0x17000567 RID: 1383
// (get) Token: 0x06001029 RID: 4137 RVA: 0x0002E868 File Offset: 0x0002CA68
public static bool OSSupportsIPv4
{
get
{
Socket.CheckProtocolSupport();
return Socket.ipv4Supported == 1;
}
}
/// <summary>Indicates whether the underlying operating system and network adaptors support Internet Protocol version 6 (IPv6).</summary>
/// <returns>true if the operating system and network adaptors support the IPv6 protocol; otherwise, false.</returns>
// Token: 0x17000568 RID: 1384
// (get) Token: 0x0600102A RID: 4138 RVA: 0x0002E878 File Offset: 0x0002CA78
public static bool OSSupportsIPv6
{
get
{
Socket.CheckProtocolSupport();
return Socket.ipv6Supported == 1;
}
}
// Token: 0x0600102B RID: 4139
[MethodImpl(MethodImplOptions.InternalCall)]
private extern IntPtr Socket_internal(AddressFamily family, SocketType type, ProtocolType proto, out int error);
/// <summary>Frees resources used by the <see cref="T:System.Net.Sockets.Socket" /> class.</summary>
// Token: 0x0600102C RID: 4140 RVA: 0x0002E888 File Offset: 0x0002CA88
~Socket()
{
this.Dispose(false);
}
/// <summary>Gets the address family of the <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>One of the <see cref="T:System.Net.Sockets.AddressFamily" /> values.</returns>
// Token: 0x17000569 RID: 1385
// (get) Token: 0x0600102D RID: 4141 RVA: 0x0002E8C4 File Offset: 0x0002CAC4
public AddressFamily AddressFamily
{
get
{
return this.address_family;
}
}
// Token: 0x0600102E RID: 4142
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Blocking_internal(IntPtr socket, bool block, out int error);
/// <summary>Gets or sets a value that indicates whether the <see cref="T:System.Net.Sockets.Socket" /> is in blocking mode.</summary>
/// <returns>true if the <see cref="T:System.Net.Sockets.Socket" /> will block; otherwise, false. The default is true.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x1700056A RID: 1386
// (get) Token: 0x0600102F RID: 4143 RVA: 0x0002E8CC File Offset: 0x0002CACC
// (set) Token: 0x06001030 RID: 4144 RVA: 0x0002E8D4 File Offset: 0x0002CAD4
public bool Blocking
{
get
{
return this.blocking;
}
set
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
int num;
Socket.Blocking_internal(this.socket, value, out num);
if (num != 0)
{
throw new SocketException(num);
}
this.blocking = value;
}
}
/// <summary>Gets a value that indicates whether a <see cref="T:System.Net.Sockets.Socket" /> is connected to a remote host as of the last <see cref="Overload:System.Net.Sockets.Socket.Send" /> or <see cref="Overload:System.Net.Sockets.Socket.Receive" /> operation.</summary>
/// <returns>true if the <see cref="T:System.Net.Sockets.Socket" /> was connected to a remote resource as of the most recent operation; otherwise, false.</returns>
// Token: 0x1700056B RID: 1387
// (get) Token: 0x06001031 RID: 4145 RVA: 0x0002E92C File Offset: 0x0002CB2C
// (set) Token: 0x06001032 RID: 4146 RVA: 0x0002E934 File Offset: 0x0002CB34
public bool Connected
{
get
{
return this.connected;
}
internal set
{
this.connected = value;
}
}
/// <summary>Gets the protocol type of the <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>One of the <see cref="T:System.Net.Sockets.ProtocolType" /> values.</returns>
// Token: 0x1700056C RID: 1388
// (get) Token: 0x06001033 RID: 4147 RVA: 0x0002E940 File Offset: 0x0002CB40
public ProtocolType ProtocolType
{
get
{
return this.protocol_type;
}
}
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that specifies whether the stream <see cref="T:System.Net.Sockets.Socket" /> is using the Nagle algorithm.</summary>
/// <returns>false if the <see cref="T:System.Net.Sockets.Socket" /> uses the Nagle algorithm; otherwise, true. The default is false.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the <see cref="T:System.Net.Sockets.Socket" />. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700056D RID: 1389
// (get) Token: 0x06001034 RID: 4148 RVA: 0x0002E948 File Offset: 0x0002CB48
// (set) Token: 0x06001035 RID: 4149 RVA: 0x0002E998 File Offset: 0x0002CB98
public bool NoDelay
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
this.ThrowIfUpd();
return (int)this.GetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.Debug) != 0;
}
set
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
this.ThrowIfUpd();
this.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.Debug, (!value) ? 0 : 1);
}
}
/// <summary>Gets or sets a value that specifies the size of the receive buffer of the <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>An <see cref="T:System.Int32" /> that contains the size, in bytes, of the receive buffer. The default is 8192.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set operation is less than 0.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700056E RID: 1390
// (get) Token: 0x06001036 RID: 4150 RVA: 0x0002E9E8 File Offset: 0x0002CBE8
// (set) Token: 0x06001037 RID: 4151 RVA: 0x0002EA34 File Offset: 0x0002CC34
public int ReceiveBufferSize
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
return (int)this.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer);
}
set
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (value < 0)
{
throw new ArgumentOutOfRangeException("value", "The value specified for a set operation is less than zero");
}
this.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, value);
}
}
/// <summary>Gets or sets a value that specifies the size of the send buffer of the <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>An <see cref="T:System.Int32" /> that contains the size, in bytes, of the send buffer. The default is 8192.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set operation is less than 0.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700056F RID: 1391
// (get) Token: 0x06001038 RID: 4152 RVA: 0x0002EA90 File Offset: 0x0002CC90
// (set) Token: 0x06001039 RID: 4153 RVA: 0x0002EADC File Offset: 0x0002CCDC
public int SendBufferSize
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
return (int)this.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer);
}
set
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (value < 0)
{
throw new ArgumentOutOfRangeException("value", "The value specified for a set operation is less than zero");
}
this.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, value);
}
}
/// <summary>Gets or sets a value that specifies the Time To Live (TTL) value of Internet Protocol (IP) packets sent by the <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <returns>The TTL value.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The TTL value can't be set to a negative number.</exception>
/// <exception cref="T:System.NotSupportedException">This property can only be retrieved or set for a socket in the <see cref="F:System.Net.Sockets.AddressFamily.InterNetwork" /> or <see cref="F:System.Net.Sockets.AddressFamily.InterNetworkV6" /> address family.</exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. This error is also returned when an attempt was made to set TTL to a value higher than 255.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x17000570 RID: 1392
// (get) Token: 0x0600103A RID: 4154 RVA: 0x0002EB38 File Offset: 0x0002CD38
// (set) Token: 0x0600103B RID: 4155 RVA: 0x0002EBBC File Offset: 0x0002CDBC
public short Ttl
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
short num;
if (this.address_family == AddressFamily.InterNetwork)
{
num = (short)((int)this.GetSocketOption(SocketOptionLevel.IP, SocketOptionName.ReuseAddress));
}
else
{
if (this.address_family != AddressFamily.InterNetworkV6)
{
throw new NotSupportedException("This property is only valid for InterNetwork and InterNetworkV6 sockets");
}
num = (short)((int)this.GetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.HopLimit));
}
return num;
}
set
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.address_family == AddressFamily.InterNetwork)
{
this.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.ReuseAddress, (int)value);
}
else
{
if (this.address_family != AddressFamily.InterNetworkV6)
{
throw new NotSupportedException("This property is only valid for InterNetwork and InterNetworkV6 sockets");
}
this.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.HopLimit, (int)value);
}
}
}
// Token: 0x0600103C RID: 4156
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern SocketAddress RemoteEndPoint_internal(IntPtr socket, out int error);
/// <summary>Gets the remote endpoint.</summary>
/// <returns>The <see cref="T:System.Net.EndPoint" /> with which the <see cref="T:System.Net.Sockets.Socket" /> is communicating.</returns>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x17000571 RID: 1393
// (get) Token: 0x0600103D RID: 4157 RVA: 0x0002EC34 File Offset: 0x0002CE34
public EndPoint RemoteEndPoint
{
get
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (this.seed_endpoint == null)
{
return null;
}
int num;
SocketAddress socketAddress = Socket.RemoteEndPoint_internal(this.socket, out num);
if (num != 0)
{
throw new SocketException(num);
}
return this.seed_endpoint.Create(socketAddress);
}
}
// Token: 0x0600103E RID: 4158 RVA: 0x0002EC9C File Offset: 0x0002CE9C
private void Linger(IntPtr handle)
{
if (!this.connected || this.linger_timeout <= 0)
{
return;
}
int num;
Socket.Shutdown_internal(handle, SocketShutdown.Receive, out num);
if (num != 0)
{
return;
}
int num2 = this.linger_timeout / 1000;
int num3 = this.linger_timeout % 1000;
if (num3 > 0)
{
Socket.Poll_internal(handle, SelectMode.SelectRead, num3 * 1000, out num);
if (num != 0)
{
return;
}
}
if (num2 > 0)
{
LingerOption lingerOption = new LingerOption(true, num2);
Socket.SetSocketOption_internal(handle, SocketOptionLevel.Socket, SocketOptionName.Linger, lingerOption, null, 0, out num);
}
}
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.Net.Sockets.Socket" />, and optionally disposes of the managed resources.</summary>
/// <param name="disposing">true to release both managed and unmanaged resources; false to releases only unmanaged resources. </param>
// Token: 0x0600103F RID: 4159 RVA: 0x0002ED30 File Offset: 0x0002CF30
protected virtual void Dispose(bool explicitDisposing)
{
if (this.disposed)
{
return;
}
this.disposed = true;
bool flag = this.connected;
this.connected = false;
if ((int)this.socket != -1)
{
if (Environment.SocketSecurityEnabled && Socket.current_bind_count > 0)
{
Socket.current_bind_count--;
}
this.closed = true;
IntPtr intPtr = this.socket;
this.socket = (IntPtr)(-1);
Thread thread = this.blocking_thread;
if (thread != null)
{
thread.Abort();
this.blocking_thread = null;
}
if (flag)
{
this.Linger(intPtr);
}
int num;
Socket.Close_internal(intPtr, out num);
if (num != 0)
{
throw new SocketException(num);
}
}
}
// Token: 0x06001040 RID: 4160 RVA: 0x0002EDE8 File Offset: 0x0002CFE8
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
// Token: 0x06001041 RID: 4161
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Close_internal(IntPtr socket, out int error);
/// <summary>Closes the <see cref="T:System.Net.Sockets.Socket" /> connection and releases all associated resources.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001042 RID: 4162 RVA: 0x0002EDF8 File Offset: 0x0002CFF8
public void Close()
{
this.linger_timeout = 0;
((IDisposable)this).Dispose();
}
/// <summary>Closes the <see cref="T:System.Net.Sockets.Socket" /> connection and releases all associated resources with a specified timeout to allow queued data to be sent.</summary>
/// <param name="timeout">Wait up to <paramref name="timeout" /> seconds to send any remaining data, then close the socket.</param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001043 RID: 4163 RVA: 0x0002EE08 File Offset: 0x0002D008
public void Close(int timeout)
{
this.linger_timeout = timeout;
((IDisposable)this).Dispose();
}
// Token: 0x06001044 RID: 4164
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Connect_internal_real(IntPtr sock, SocketAddress sa, out int error);
// Token: 0x06001045 RID: 4165 RVA: 0x0002EE18 File Offset: 0x0002D018
private static void Connect_internal(IntPtr sock, SocketAddress sa, out int error)
{
Socket.Connect_internal(sock, sa, out error, true);
}
// Token: 0x06001046 RID: 4166 RVA: 0x0002EE24 File Offset: 0x0002D024
private static void Connect_internal(IntPtr sock, SocketAddress sa, out int error, bool requireSocketPolicyFile)
{
if (requireSocketPolicyFile && !Socket.CheckEndPoint(sa))
{
throw new SecurityException("Unable to connect, as no valid crossdomain policy was found");
}
Socket.Connect_internal_real(sock, sa, out error);
}
// Token: 0x06001047 RID: 4167 RVA: 0x0002EE58 File Offset: 0x0002D058
internal static bool CheckEndPoint(SocketAddress sa)
{
if (!Environment.SocketSecurityEnabled)
{
return true;
}
bool flag;
try
{
IPEndPoint ipendPoint = new IPEndPoint(IPAddress.Loopback, 123);
IPEndPoint ipendPoint2 = (IPEndPoint)ipendPoint.Create(sa);
if (Socket.check_socket_policy == null)
{
Socket.check_socket_policy = Socket.GetUnityCrossDomainHelperMethod("CheckSocketEndPoint");
}
flag = (bool)Socket.check_socket_policy.Invoke(null, new object[]
{
ipendPoint2.Address.ToString(),
ipendPoint2.Port
});
}
catch (Exception ex)
{
Console.WriteLine("Unexpected error while trying to CheckEndPoint() : " + ex);
flag = false;
}
return flag;
}
// Token: 0x06001048 RID: 4168 RVA: 0x0002EF1C File Offset: 0x0002D11C
private static MethodInfo GetUnityCrossDomainHelperMethod(string methodname)
{
Type type = Type.GetType("UnityEngine.UnityCrossDomainHelper, CrossDomainPolicyParser, Version=1.0.0.0, Culture=neutral");
if (type == null)
{
throw new SecurityException("Cant find type UnityCrossDomainHelper");
}
MethodInfo method = type.GetMethod(methodname);
if (method == null)
{
throw new SecurityException("Cant find " + methodname);
}
return method;
}
/// <summary>Establishes a connection to a remote host.</summary>
/// <param name="remoteEP">An <see cref="T:System.Net.EndPoint" /> that represents the remote device. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="remoteEP" /> is null. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Security.SecurityException">A caller higher in the call stack does not have permission for the requested operation. </exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Net.Sockets.Socket" /> is <see cref="M:System.Net.Sockets.Socket.Listen(System.Int32)" />ing.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Net.SocketPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001049 RID: 4169 RVA: 0x0002EF68 File Offset: 0x0002D168
public void Connect(EndPoint remoteEP)
{
this.Connect(remoteEP, true);
}
// Token: 0x0600104A RID: 4170 RVA: 0x0002EF74 File Offset: 0x0002D174
internal void Connect(EndPoint remoteEP, bool requireSocketPolicy)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (remoteEP == null)
{
throw new ArgumentNullException("remoteEP");
}
IPEndPoint ipendPoint = remoteEP as IPEndPoint;
if (ipendPoint != null && (ipendPoint.Address.Equals(IPAddress.Any) || ipendPoint.Address.Equals(IPAddress.IPv6Any)))
{
throw new SocketException(10049);
}
if (this.islistening)
{
throw new InvalidOperationException();
}
SocketAddress socketAddress = remoteEP.Serialize();
int num = 0;
this.blocking_thread = Thread.CurrentThread;
try
{
Socket.Connect_internal(this.socket, socketAddress, out num, requireSocketPolicy);
}
catch (ThreadAbortException)
{
if (this.disposed)
{
Thread.ResetAbort();
num = 10004;
}
}
finally
{
this.blocking_thread = null;
}
if (num != 0)
{
throw new SocketException(num);
}
this.connected = true;
this.isbound = true;
this.seed_endpoint = remoteEP;
}
/// <summary>Begins an asynchronous request to receive data from a connected <see cref="T:System.Net.Sockets.Socket" /> object.</summary>
/// <returns>Returns true if the I/O operation is pending. The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will be raised upon completion of the operation. Returns false if the I/O operation completed synchronously. In this case, The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will not be raised and the <paramref name="e" /> object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.</returns>
/// <param name="e">The <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object to use for this asynchronous socket operation.</param>
/// <exception cref="T:System.ArgumentException">An argument was invalid. The <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.Buffer" /> or <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.BufferList" /> properties on the <paramref name="e" /> parameter must reference valid buffers. One or the other of these properties may be set, but not both at the same time.</exception>
/// <exception cref="T:System.InvalidOperationException">A socket operation was already in progress using the <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object specified in the <paramref name="e" /> parameter.</exception>
/// <exception cref="T:System.NotSupportedException">Windows XP or later is required for this method.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
// Token: 0x0600104B RID: 4171 RVA: 0x0002F0B0 File Offset: 0x0002D2B0
public bool ReceiveAsync(SocketAsyncEventArgs e)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (e.BufferList != null)
{
throw new NotSupportedException("Mono doesn't support using BufferList at this point.");
}
e.DoOperation(SocketAsyncOperation.Receive, this);
return true;
}
/// <summary>Sends data asynchronously to a connected <see cref="T:System.Net.Sockets.Socket" /> object.</summary>
/// <returns>Returns true if the I/O operation is pending. The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will be raised upon completion of the operation. Returns false if the I/O operation completed synchronously. In this case, The <see cref="E:System.Net.Sockets.SocketAsyncEventArgs.Completed" /> event on the <paramref name="e" /> parameter will not be raised and the <paramref name="e" /> object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.</returns>
/// <param name="e">The <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object to use for this asynchronous socket operation.</param>
/// <exception cref="T:System.ArgumentException">The <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.Buffer" /> or <see cref="P:System.Net.Sockets.SocketAsyncEventArgs.BufferList" /> properties on the <paramref name="e" /> parameter must reference valid buffers. One or the other of these properties may be set, but not both at the same time.</exception>
/// <exception cref="T:System.InvalidOperationException">A socket operation was already in progress using the <see cref="T:System.Net.Sockets.SocketAsyncEventArgs" /> object specified in the <paramref name="e" /> parameter.</exception>
/// <exception cref="T:System.NotSupportedException">Windows XP or later is required for this method.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <exception cref="T:System.Net.Sockets.SocketException">The <see cref="T:System.Net.Sockets.Socket" /> is not yet connected or was not obtained via an <see cref="M:System.Net.Sockets.Socket.Accept" />, <see cref="M:System.Net.Sockets.Socket.AcceptAsync(System.Net.Sockets.SocketAsyncEventArgs)" />,or <see cref="Overload:System.Net.Sockets.Socket.BeginAccept" />, method.</exception>
// Token: 0x0600104C RID: 4172 RVA: 0x0002F104 File Offset: 0x0002D304
public bool SendAsync(SocketAsyncEventArgs e)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (e.Buffer == null && e.BufferList == null)
{
throw new ArgumentException("Either e.Buffer or e.BufferList must be valid buffers.");
}
e.DoOperation(SocketAsyncOperation.Send, this);
return true;
}
// Token: 0x0600104D RID: 4173
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool Poll_internal(IntPtr socket, SelectMode mode, int timeout, out int error);
// Token: 0x0600104E RID: 4174 RVA: 0x0002F164 File Offset: 0x0002D364
internal bool Poll(int time_us, SelectMode mode, out int socket_error)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (mode != SelectMode.SelectRead && mode != SelectMode.SelectWrite && mode != SelectMode.SelectError)
{
throw new NotSupportedException("'mode' parameter is not valid.");
}
int num;
bool flag = Socket.Poll_internal(this.socket, mode, time_us, out num);
if (num != 0)
{
throw new SocketException(num);
}
socket_error = (int)this.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error);
if (mode == SelectMode.SelectWrite && flag && socket_error == 0)
{
this.connected = true;
}
return flag;
}
// Token: 0x0600104F RID: 4175
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int Receive_internal(IntPtr sock, byte[] buffer, int offset, int count, SocketFlags flags, out int error);
// Token: 0x06001050 RID: 4176 RVA: 0x0002F208 File Offset: 0x0002D408
internal int Receive_nochecks(byte[] buf, int offset, int size, SocketFlags flags, out SocketError error)
{
if (this.protocol_type == ProtocolType.Udp && Environment.SocketSecurityEnabled)
{
IPAddress ipaddress = IPAddress.Any;
if (this.address_family == AddressFamily.InterNetworkV6)
{
ipaddress = IPAddress.IPv6Any;
}
EndPoint endPoint = new IPEndPoint(ipaddress, 0);
int num = 0;
int num2 = this.ReceiveFrom_nochecks_exc(buf, offset, size, flags, ref endPoint, false, out num);
error = (SocketError)num;
return num2;
}
int num4;
int num3 = Socket.Receive_internal(this.socket, buf, offset, size, flags, out num4);
error = (SocketError)num4;
if (error != SocketError.Success && error != SocketError.WouldBlock && error != SocketError.InProgress)
{
this.connected = false;
}
else
{
this.connected = true;
}
return num3;
}
// Token: 0x06001051 RID: 4177
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void GetSocketOption_obj_internal(IntPtr socket, SocketOptionLevel level, SocketOptionName name, out object obj_val, out int error);
// Token: 0x06001052 RID: 4178
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int Send_internal(IntPtr sock, byte[] buf, int offset, int count, SocketFlags flags, out int error);
// Token: 0x06001053 RID: 4179 RVA: 0x0002F2B8 File Offset: 0x0002D4B8
internal int Send_nochecks(byte[] buf, int offset, int size, SocketFlags flags, out SocketError error)
{
if (size == 0)
{
error = SocketError.Success;
return 0;
}
int num2;
int num = Socket.Send_internal(this.socket, buf, offset, size, flags, out num2);
error = (SocketError)num2;
if (error != SocketError.Success && error != SocketError.WouldBlock && error != SocketError.InProgress)
{
this.connected = false;
}
else
{
this.connected = true;
}
return num;
}
/// <summary>Returns the value of a specified <see cref="T:System.Net.Sockets.Socket" /> option, represented as an object.</summary>
/// <returns>An object that represents the value of the option. When the <paramref name="optionName" /> parameter is set to <see cref="F:System.Net.Sockets.SocketOptionName.Linger" /> the return value is an instance of the <see cref="T:System.Net.Sockets.LingerOption" /> class. When <paramref name="optionName" /> is set to <see cref="F:System.Net.Sockets.SocketOptionName.AddMembership" /> or <see cref="F:System.Net.Sockets.SocketOptionName.DropMembership" />, the return value is an instance of the <see cref="T:System.Net.Sockets.MulticastOption" /> class. When <paramref name="optionName" /> is any other value, the return value is an integer.</returns>
/// <param name="optionLevel">One of the <see cref="T:System.Net.Sockets.SocketOptionLevel" /> values. </param>
/// <param name="optionName">One of the <see cref="T:System.Net.Sockets.SocketOptionName" /> values. </param>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information.-or-<paramref name="optionName" /> was set to the unsupported value <see cref="F:System.Net.Sockets.SocketOptionName.MaxConnections" />.</exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001054 RID: 4180 RVA: 0x0002F320 File Offset: 0x0002D520
public object GetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
object obj;
int num;
Socket.GetSocketOption_obj_internal(this.socket, optionLevel, optionName, out obj, out num);
if (num != 0)
{
throw new SocketException(num);
}
if (optionName == SocketOptionName.Linger)
{
return (LingerOption)obj;
}
if (optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership)
{
return (MulticastOption)obj;
}
if (obj is int)
{
return (int)obj;
}
return obj;
}
// Token: 0x06001055 RID: 4181
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Shutdown_internal(IntPtr socket, SocketShutdown how, out int error);
/// <summary>Disables sends and receives on a <see cref="T:System.Net.Sockets.Socket" />.</summary>
/// <param name="how">One of the <see cref="T:System.Net.Sockets.SocketShutdown" /> values that specifies the operation that will no longer be allowed. </param>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// </PermissionSet>
// Token: 0x06001056 RID: 4182 RVA: 0x0002F3B4 File Offset: 0x0002D5B4
public void Shutdown(SocketShutdown how)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
if (!this.connected)
{
throw new SocketException(10057);
}
int num;
Socket.Shutdown_internal(this.socket, how, out num);
if (num != 0)
{
throw new SocketException(num);
}
}
// Token: 0x06001057 RID: 4183
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void SetSocketOption_internal(IntPtr socket, SocketOptionLevel level, SocketOptionName name, object obj_val, byte[] byte_val, int int_val, out int error);
/// <summary>Sets the specified <see cref="T:System.Net.Sockets.Socket" /> option to the specified integer value.</summary>
/// <param name="optionLevel">One of the <see cref="T:System.Net.Sockets.SocketOptionLevel" /> values. </param>
/// <param name="optionName">One of the <see cref="T:System.Net.Sockets.SocketOptionName" /> values. </param>
/// <param name="optionValue">A value of the option. </param>
/// <exception cref="T:System.Net.Sockets.SocketException">An error occurred when attempting to access the socket. See the Remarks section for more information. </exception>
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.Sockets.Socket" /> has been closed. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06001058 RID: 4184 RVA: 0x0002F41C File Offset: 0x0002D61C
public void SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, int optionValue)
{
if (this.disposed && this.closed)
{
throw new ObjectDisposedException(base.GetType().ToString());
}
int num;
Socket.SetSocketOption_internal(this.socket, optionLevel, optionName, null, null, optionValue, out num);
if (num != 0)
{
throw new SocketException(num);
}
}
// Token: 0x06001059 RID: 4185 RVA: 0x0002F470 File Offset: 0x0002D670
private void ThrowIfUpd()
{
}
// Token: 0x04000E47 RID: 3655
private Queue readQ = new Queue(2);
// Token: 0x04000E48 RID: 3656
private Queue writeQ = new Queue(2);
// Token: 0x04000E49 RID: 3657
private bool islistening;
// Token: 0x04000E4A RID: 3658
private bool useoverlappedIO;
// Token: 0x04000E4B RID: 3659
private readonly int MinListenPort = 7100;
// Token: 0x04000E4C RID: 3660
private readonly int MaxListenPort = 7150;
// Token: 0x04000E4D RID: 3661
private static int ipv4Supported = -1;
// Token: 0x04000E4E RID: 3662
private static int ipv6Supported = -1;
// Token: 0x04000E4F RID: 3663
private int linger_timeout;
// Token: 0x04000E50 RID: 3664
private IntPtr socket;
// Token: 0x04000E51 RID: 3665
private AddressFamily address_family;
// Token: 0x04000E52 RID: 3666
private SocketType socket_type;
// Token: 0x04000E53 RID: 3667
private ProtocolType protocol_type;
// Token: 0x04000E54 RID: 3668
internal bool blocking = true;
// Token: 0x04000E55 RID: 3669
private Thread blocking_thread;
// Token: 0x04000E56 RID: 3670
private bool isbound;
// Token: 0x04000E57 RID: 3671
private static int current_bind_count;
// Token: 0x04000E58 RID: 3672
private readonly int max_bind_count = 50;
// Token: 0x04000E59 RID: 3673
private bool connected;
// Token: 0x04000E5A RID: 3674
private bool closed;
// Token: 0x04000E5B RID: 3675
internal bool disposed;
// Token: 0x04000E5C RID: 3676
internal EndPoint seed_endpoint;
// Token: 0x04000E5D RID: 3677
private static MethodInfo check_socket_policy;
// Token: 0x020001E5 RID: 485
private enum SocketOperation
{
// Token: 0x04000E5F RID: 3679
Accept,
// Token: 0x04000E60 RID: 3680
Connect,
// Token: 0x04000E61 RID: 3681
Receive,
// Token: 0x04000E62 RID: 3682
ReceiveFrom,
// Token: 0x04000E63 RID: 3683
Send,
// Token: 0x04000E64 RID: 3684
SendTo,
// Token: 0x04000E65 RID: 3685
UsedInManaged1,
// Token: 0x04000E66 RID: 3686
UsedInManaged2,
// Token: 0x04000E67 RID: 3687
UsedInProcess,
// Token: 0x04000E68 RID: 3688
UsedInConsole2,
// Token: 0x04000E69 RID: 3689
Disconnect,
// Token: 0x04000E6A RID: 3690
AcceptReceive,
// Token: 0x04000E6B RID: 3691
ReceiveGeneric,
// Token: 0x04000E6C RID: 3692
SendGeneric
}
// Token: 0x020001E6 RID: 486
private struct WSABUF
{
// Token: 0x04000E6D RID: 3693
public int len;
// Token: 0x04000E6E RID: 3694
public IntPtr buf;
}
// Token: 0x020001E7 RID: 487
[StructLayout(LayoutKind.Sequential)]
private sealed class SocketAsyncResult : IAsyncResult
{
// Token: 0x0600105A RID: 4186 RVA: 0x0002F474 File Offset: 0x0002D674
public SocketAsyncResult(Socket sock, object state, AsyncCallback callback, Socket.SocketOperation operation)
{
this.Sock = sock;
this.blocking = sock.blocking;
this.handle = sock.socket;
this.state = state;
this.callback = callback;
this.operation = operation;
this.SockFlags = SocketFlags.None;
}
// Token: 0x0600105B RID: 4187 RVA: 0x0002F4C4 File Offset: 0x0002D6C4
public void CheckIfThrowDelayedException()
{
if (this.delayedException != null)
{
this.Sock.connected = false;
throw this.delayedException;
}
if (this.error != 0)
{
this.Sock.connected = false;
throw new SocketException(this.error);
}
}
// Token: 0x0600105C RID: 4188 RVA: 0x0002F514 File Offset: 0x0002D714
private void CompleteAllOnDispose(Queue queue)
{
object[] array = queue.ToArray();
queue.Clear();
foreach (Socket.SocketAsyncResult socketAsyncResult in array)
{
WaitCallback waitCallback = new WaitCallback(socketAsyncResult.CompleteDisposed);
ThreadPool.QueueUserWorkItem(waitCallback, null);
}
if (array.Length == 0)
{
this.Buffer = null;
}
}
// Token: 0x0600105D RID: 4189 RVA: 0x0002F570 File Offset: 0x0002D770
private void CompleteDisposed(object unused)
{
this.Complete();
}
// Token: 0x0600105E RID: 4190 RVA: 0x0002F578 File Offset: 0x0002D778
public void Complete()
{
if (this.operation != Socket.SocketOperation.Receive && this.Sock.disposed)
{
this.delayedException = new ObjectDisposedException(this.Sock.GetType().ToString());
}
this.IsCompleted = true;
Queue queue = null;
if (this.operation == Socket.SocketOperation.Receive || this.operation == Socket.SocketOperation.ReceiveFrom || this.operation == Socket.SocketOperation.ReceiveGeneric)
{
queue = this.Sock.readQ;
}
else if (this.operation == Socket.SocketOperation.Send || this.operation == Socket.SocketOperation.SendTo || this.operation == Socket.SocketOperation.SendGeneric)
{
queue = this.Sock.writeQ;
}
if (queue != null)
{
Socket.SocketAsyncCall socketAsyncCall = null;
Socket.SocketAsyncResult socketAsyncResult = null;
Queue queue2 = queue;
lock (queue2)
{
queue.Dequeue();
if (queue.Count > 0)
{
socketAsyncResult = (Socket.SocketAsyncResult)queue.Peek();
if (!this.Sock.disposed)
{
Socket.Worker worker = new Socket.Worker(socketAsyncResult);
socketAsyncCall = this.GetDelegate(worker, socketAsyncResult.operation);
}
else
{
this.CompleteAllOnDispose(queue);
}
}
}
if (socketAsyncCall != null)
{
socketAsyncCall.BeginInvoke(null, socketAsyncResult);
}
}
if (this.callback != null)
{
this.callback(this);
}
this.Buffer = null;
}
// Token: 0x0600105F RID: 4191 RVA: 0x0002F6E8 File Offset: 0x0002D8E8
private Socket.SocketAsyncCall GetDelegate(Socket.Worker worker, Socket.SocketOperation op)
{
switch (op)
{
case Socket.SocketOperation.Receive:
return new Socket.SocketAsyncCall(worker.Receive);
case Socket.SocketOperation.ReceiveFrom:
return new Socket.SocketAsyncCall(worker.ReceiveFrom);
case Socket.SocketOperation.Send:
return new Socket.SocketAsyncCall(worker.Send);
case Socket.SocketOperation.SendTo:
return new Socket.SocketAsyncCall(worker.SendTo);
default:
return null;
}
}
// Token: 0x06001060 RID: 4192 RVA: 0x0002F74C File Offset: 0x0002D94C
public void Complete(bool synch)
{
this.completed_sync = synch;
this.Complete();
}
// Token: 0x06001061 RID: 4193 RVA: 0x0002F75C File Offset: 0x0002D95C
public void Complete(int total)
{
this.total = total;
this.Complete();
}
// Token: 0x06001062 RID: 4194 RVA: 0x0002F76C File Offset: 0x0002D96C
public void Complete(Exception e, bool synch)
{
this.completed_sync = synch;
this.delayedException = e;
this.Complete();
}
// Token: 0x06001063 RID: 4195 RVA: 0x0002F784 File Offset: 0x0002D984
public void Complete(Exception e)
{
this.delayedException = e;
this.Complete();
}
// Token: 0x06001064 RID: 4196 RVA: 0x0002F794 File Offset: 0x0002D994
public void Complete(Socket s)
{
this.acc_socket = s;
this.Complete();
}
// Token: 0x06001065 RID: 4197 RVA: 0x0002F7A4 File Offset: 0x0002D9A4
public void Complete(Socket s, int total)
{
this.acc_socket = s;
this.total = total;
this.Complete();
}
// Token: 0x17000572 RID: 1394
// (get) Token: 0x06001066 RID: 4198 RVA: 0x0002F7BC File Offset: 0x0002D9BC
public object AsyncState
{
get
{
return this.state;
}
}
// Token: 0x17000573 RID: 1395
// (get) Token: 0x06001067 RID: 4199 RVA: 0x0002F7C4 File Offset: 0x0002D9C4
// (set) Token: 0x06001068 RID: 4200 RVA: 0x0002F824 File Offset: 0x0002DA24
public WaitHandle AsyncWaitHandle
{
get
{
lock (this)
{
if (this.waithandle == null)
{
this.waithandle = new ManualResetEvent(this.completed);
}
}
return this.waithandle;
}
set
{
this.waithandle = value;
}
}
// Token: 0x17000574 RID: 1396
// (get) Token: 0x06001069 RID: 4201 RVA: 0x0002F830 File Offset: 0x0002DA30
public bool CompletedSynchronously
{
get
{
return this.completed_sync;
}
}
// Token: 0x17000575 RID: 1397
// (get) Token: 0x0600106A RID: 4202 RVA: 0x0002F838 File Offset: 0x0002DA38
// (set) Token: 0x0600106B RID: 4203 RVA: 0x0002F840 File Offset: 0x0002DA40
public bool IsCompleted
{
get
{
return this.completed;
}
set
{
this.completed = value;
lock (this)
{
if (this.waithandle != null && value)
{
((ManualResetEvent)this.waithandle).Set();
}
}
}
}
// Token: 0x17000576 RID: 1398
// (get) Token: 0x0600106C RID: 4204 RVA: 0x0002F8A8 File Offset: 0x0002DAA8
public Socket Socket
{
get
{
return this.acc_socket;
}
}
// Token: 0x17000577 RID: 1399
// (get) Token: 0x0600106D RID: 4205 RVA: 0x0002F8B0 File Offset: 0x0002DAB0
// (set) Token: 0x0600106E RID: 4206 RVA: 0x0002F8B8 File Offset: 0x0002DAB8
public int Total
{
get
{
return this.total;
}
set
{
this.total = value;
}
}
// Token: 0x17000578 RID: 1400
// (get) Token: 0x0600106F RID: 4207 RVA: 0x0002F8C4 File Offset: 0x0002DAC4
public SocketError ErrorCode
{
get
{
SocketException ex = this.delayedException as SocketException;
if (ex != null)
{
return ex.SocketErrorCode;
}
if (this.error != 0)
{
return (SocketError)this.error;
}
return SocketError.Success;
}
}
// Token: 0x04000E6F RID: 3695
public Socket Sock;
// Token: 0x04000E70 RID: 3696
public IntPtr handle;
// Token: 0x04000E71 RID: 3697
private object state;
// Token: 0x04000E72 RID: 3698
private AsyncCallback callback;
// Token: 0x04000E73 RID: 3699
private WaitHandle waithandle;
// Token: 0x04000E74 RID: 3700
private Exception delayedException;
// Token: 0x04000E75 RID: 3701
public EndPoint EndPoint;
// Token: 0x04000E76 RID: 3702
public byte[] Buffer;
// Token: 0x04000E77 RID: 3703
public int Offset;
// Token: 0x04000E78 RID: 3704
public int Size;
// Token: 0x04000E79 RID: 3705
public SocketFlags SockFlags;
// Token: 0x04000E7A RID: 3706
public Socket AcceptSocket;
// Token: 0x04000E7B RID: 3707
public IPAddress[] Addresses;
// Token: 0x04000E7C RID: 3708
public int Port;
// Token: 0x04000E7D RID: 3709
public IList<ArraySegment<byte>> Buffers;
// Token: 0x04000E7E RID: 3710
public bool ReuseSocket;
// Token: 0x04000E7F RID: 3711
private Socket acc_socket;
// Token: 0x04000E80 RID: 3712
private int total;
// Token: 0x04000E81 RID: 3713
private bool completed_sync;
// Token: 0x04000E82 RID: 3714
private bool completed;
// Token: 0x04000E83 RID: 3715
public bool blocking;
// Token: 0x04000E84 RID: 3716
internal int error;
// Token: 0x04000E85 RID: 3717
private Socket.SocketOperation operation;
// Token: 0x04000E86 RID: 3718
public object ares;
// Token: 0x04000E87 RID: 3719
public int EndCalled;
}
// Token: 0x020001E8 RID: 488
private sealed class Worker
{
// Token: 0x06001070 RID: 4208 RVA: 0x0002F900 File Offset: 0x0002DB00
public Worker(Socket.SocketAsyncResult ares)
: this(ares, true)
{
}
// Token: 0x06001071 RID: 4209 RVA: 0x0002F90C File Offset: 0x0002DB0C
public Worker(Socket.SocketAsyncResult ares, bool requireSocketSecurity)
{
this.result = ares;
this.requireSocketSecurity = requireSocketSecurity;
}
// Token: 0x06001072 RID: 4210 RVA: 0x0002F924 File Offset: 0x0002DB24
public void Accept()
{
Socket socket = null;
try
{
socket = this.result.Sock.Accept();
}
catch (Exception ex)
{
this.result.Complete(ex);
return;
}
this.result.Complete(socket);
}
// Token: 0x06001073 RID: 4211 RVA: 0x0002F988 File Offset: 0x0002DB88
public void AcceptReceive()
{
Socket socket = null;
try
{
if (this.result.AcceptSocket == null)
{
socket = this.result.Sock.Accept();
}
else
{
socket = this.result.AcceptSocket;
this.result.Sock.Accept(socket);
}
}
catch (Exception ex)
{
this.result.Complete(ex);
return;
}
int num = 0;
if (this.result.Size > 0)
{
try
{
SocketError socketError;
num = socket.Receive_nochecks(this.result.Buffer, this.result.Offset, this.result.Size, this.result.SockFlags, out socketError);
}
catch (Exception ex2)
{
this.result.Complete(ex2);
return;
}
}
this.result.Complete(socket, num);
}
// Token: 0x06001074 RID: 4212 RVA: 0x0002FAA0 File Offset: 0x0002DCA0
public void Connect()
{
if (this.result.EndPoint != null)
{
try
{
if (!this.result.Sock.Blocking)
{
int num;
this.result.Sock.Poll(-1, SelectMode.SelectWrite, out num);
if (num != 0)
{
this.result.Complete(new SocketException(num));
return;
}
this.result.Sock.connected = true;
}
else
{
this.result.Sock.seed_endpoint = this.result.EndPoint;
this.result.Sock.Connect(this.result.EndPoint, this.requireSocketSecurity);
this.result.Sock.connected = true;
}
}
catch (Exception ex)
{
this.result.Complete(ex);
return;
}
this.result.Complete();
}
else if (this.result.Addresses != null)
{
int num2 = 10036;
foreach (IPAddress ipaddress in this.result.Addresses)
{
IPEndPoint ipendPoint = new IPEndPoint(ipaddress, this.result.Port);
SocketAddress socketAddress = ipendPoint.Serialize();
try
{
Socket.Connect_internal(this.result.Sock.socket, socketAddress, out num2, this.requireSocketSecurity);
}
catch (Exception ex2)
{
this.result.Complete(ex2);
return;
}
if (num2 == 0)
{
this.result.Sock.connected = true;
this.result.Sock.seed_endpoint = ipendPoint;
this.result.Complete();
return;
}
if (num2 == 10036 || num2 == 10035)
{
if (!this.result.Sock.Blocking)
{
int num3;
this.result.Sock.Poll(-1, SelectMode.SelectWrite, out num3);
if (num3 == 0)
{
this.result.Sock.connected = true;
this.result.Sock.seed_endpoint = ipendPoint;
this.result.Complete();
return;
}
}
}
}
this.result.Complete(new SocketException(num2));
}
else
{
this.result.Complete(new SocketException(10049));
}
}
// Token: 0x06001075 RID: 4213 RVA: 0x0002FD44 File Offset: 0x0002DF44
public void Disconnect()
{
try
{
this.result.Sock.Disconnect(this.result.ReuseSocket);
}
catch (Exception ex)
{
this.result.Complete(ex);
return;
}
this.result.Complete();
}
// Token: 0x06001076 RID: 4214 RVA: 0x0002FDB0 File Offset: 0x0002DFB0
public void Receive()
{
this.result.Complete();
}
// Token: 0x06001077 RID: 4215 RVA: 0x0002FDC0 File Offset: 0x0002DFC0
public void ReceiveFrom()
{
int num = 0;
try
{
num = this.result.Sock.ReceiveFrom_nochecks(this.result.Buffer, this.result.Offset, this.result.Size, this.result.SockFlags, ref this.result.EndPoint);
}
catch (Exception ex)
{
this.result.Complete(ex);
return;
}
this.result.Complete(num);
}
// Token: 0x06001078 RID: 4216 RVA: 0x0002FE5C File Offset: 0x0002E05C
public void ReceiveGeneric()
{
int num = 0;
try
{
SocketError socketError;
num = this.result.Sock.Receive(this.result.Buffers, this.result.SockFlags, out socketError);
}
catch (Exception ex)
{
this.result.Complete(ex);
return;
}
this.result.Complete(num);
}
// Token: 0x06001079 RID: 4217 RVA: 0x0002FED8 File Offset: 0x0002E0D8
private void UpdateSendValues(int last_sent)
{
if (this.result.error == 0)
{
this.send_so_far += last_sent;
this.result.Offset += last_sent;
this.result.Size -= last_sent;
}
}
// Token: 0x0600107A RID: 4218 RVA: 0x0002FF2C File Offset: 0x0002E12C
public void Send()
{
if (this.result.error == 0)
{
this.UpdateSendValues(this.result.Total);
if (this.result.Sock.disposed)
{
this.result.Complete();
return;
}
if (this.result.Size > 0)
{
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(this.Send);
socketAsyncCall.BeginInvoke(null, this.result);
return;
}
this.result.Total = this.send_so_far;
}
this.result.Complete();
}
// Token: 0x0600107B RID: 4219 RVA: 0x0002FFC4 File Offset: 0x0002E1C4
public void SendTo()
{
try
{
int num = this.result.Sock.SendTo_nochecks(this.result.Buffer, this.result.Offset, this.result.Size, this.result.SockFlags, this.result.EndPoint);
this.UpdateSendValues(num);
if (this.result.Size > 0)
{
Socket.SocketAsyncCall socketAsyncCall = new Socket.SocketAsyncCall(this.SendTo);
socketAsyncCall.BeginInvoke(null, this.result);
return;
}
this.result.Total = this.send_so_far;
}
catch (Exception ex)
{
this.result.Complete(ex);
return;
}
this.result.Complete();
}
// Token: 0x0600107C RID: 4220 RVA: 0x000300A8 File Offset: 0x0002E2A8
public void SendGeneric()
{
int num = 0;
try
{
SocketError socketError;
num = this.result.Sock.Send(this.result.Buffers, this.result.SockFlags, out socketError);
}
catch (Exception ex)
{
this.result.Complete(ex);
return;
}
this.result.Complete(num);
}
// Token: 0x04000E88 RID: 3720
private Socket.SocketAsyncResult result;
// Token: 0x04000E89 RID: 3721
private bool requireSocketSecurity;
// Token: 0x04000E8A RID: 3722
private int send_so_far;
}
// Token: 0x020001E9 RID: 489
private sealed class SendFileAsyncResult : IAsyncResult
{
// Token: 0x0600107D RID: 4221 RVA: 0x00030124 File Offset: 0x0002E324
public SendFileAsyncResult(Socket.SendFileHandler d, IAsyncResult ares)
{
this.d = d;
this.ares = ares;
}
// Token: 0x17000579 RID: 1401
// (get) Token: 0x0600107E RID: 4222 RVA: 0x0003013C File Offset: 0x0002E33C
public object AsyncState
{
get
{
return this.ares.AsyncState;
}
}
// Token: 0x1700057A RID: 1402
// (get) Token: 0x0600107F RID: 4223 RVA: 0x0003014C File Offset: 0x0002E34C
public WaitHandle AsyncWaitHandle
{
get
{
return this.ares.AsyncWaitHandle;
}
}
// Token: 0x1700057B RID: 1403
// (get) Token: 0x06001080 RID: 4224 RVA: 0x0003015C File Offset: 0x0002E35C
public bool CompletedSynchronously
{
get
{
return this.ares.CompletedSynchronously;
}
}
// Token: 0x1700057C RID: 1404
// (get) Token: 0x06001081 RID: 4225 RVA: 0x0003016C File Offset: 0x0002E36C
public bool IsCompleted
{
get
{
return this.ares.IsCompleted;
}
}
// Token: 0x1700057D RID: 1405
// (get) Token: 0x06001082 RID: 4226 RVA: 0x0003017C File Offset: 0x0002E37C
public Socket.SendFileHandler Delegate
{
get
{
return this.d;
}
}
// Token: 0x1700057E RID: 1406
// (get) Token: 0x06001083 RID: 4227 RVA: 0x00030184 File Offset: 0x0002E384
public IAsyncResult Original
{
get
{
return this.ares;
}
}
// Token: 0x04000E8B RID: 3723
private IAsyncResult ares;
// Token: 0x04000E8C RID: 3724
private Socket.SendFileHandler d;
}
// Token: 0x0200030E RID: 782
// (Invoke) Token: 0x06001C11 RID: 7185
private delegate void SocketAsyncCall();
// Token: 0x0200030F RID: 783
// (Invoke) Token: 0x06001C15 RID: 7189
private delegate void SendFileHandler(string fileName, byte[] preBuffer, byte[] postBuffer, TransmitFileOptions flags);
}
}