/// <summary> /// send to the specified ip without using parameters of the current object (classical use of socket for sending) /// </summary> /// <param name="ip"></param> /// <param name="port"></param> /// <param name="protocol"></param> /// <param name="ttl"></param> /// <param name="data"></param> public void send_without_forging(string ip, ushort port, System.Net.Sockets.ProtocolType protocol, byte ttl, byte[] data) { System.Net.IPAddress ipaddr; // making end point try { // don't resolve if ip is like xxx.yyy.uuu.vvv ipaddr = System.Net.IPAddress.Parse(ip); } catch { System.Net.IPHostEntry iphe; // else resolve try { iphe = System.Net.Dns.Resolve(ip); } catch (Exception e) { this.event_Socket_Error(this, new EventArgs_Exception(e)); return; } ipaddr = iphe.AddressList[0]; } this.send_without_forging(ipaddr, port, protocol, ttl, data); }
/// <summary> /// Retrieves the Serial Settings from a Airlink Modem /// </summary> /// <param name="messengerSession">The messengerSession to perform the transaction on</param> /// <returns>A List of variables containing the serial settings of the modem</returns> public static List <Variable> GetSerialSettings(SnmpMessenger messengerSession) { PmppEndPoint?old = null; int olv = messengerSession.SnmpVersion; System.Net.Sockets.ProtocolType oldType = messengerSession.TrasnportProtocol; if (messengerSession.PmppEndPoint.HasValue) { old = messengerSession.PmppEndPoint; messengerSession.PmppEndPoint = null; } List <string> objects = new List <string>() { "1.3.6.1.4.1.20542.2.9.0", //serialPortSettings "1.3.6.1.4.1.20542.2.10.0" //serialPortFlowControl }; messengerSession.TrasnportProtocol = System.Net.Sockets.ProtocolType.Udp; messengerSession.SnmpVersion = 2; List <Variable> results = messengerSession.Get(objects).Bindings; if (old.HasValue) { messengerSession.PmppEndPoint = old; } messengerSession.TrasnportProtocol = oldType; messengerSession.SnmpVersion = olv; return(results); }
/// <summary> /// Retrieves the Network Provider Information from a Airlink Modem /// </summary> /// <param name="messengerSession">The messengerSession to perform the transaction on</param> /// <returns>A Variable indicating the Network Provider Information of the modem</returns> public static Variable GetModemNetworkProvider(SnmpMessenger messengerSession) { PmppEndPoint?old = null; int oldv = messengerSession.SnmpVersion; System.Net.Sockets.ProtocolType oldType = messengerSession.TrasnportProtocol; if (messengerSession.PmppEndPoint.HasValue) { old = messengerSession.PmppEndPoint; messengerSession.PmppEndPoint = null; } messengerSession.TrasnportProtocol = System.Net.Sockets.ProtocolType.Udp; messengerSession.SnmpVersion = 2; //voltage Variable result = messengerSession.Get("1.3.6.1.4.1.20542.3.10.0").Bindings[0]; if (old.HasValue) { messengerSession.PmppEndPoint = old; } messengerSession.TrasnportProtocol = oldType; messengerSession.SnmpVersion = oldv; //voltage return(result); }
public void send_without_forging(System.Net.IPAddress ipaddr, ushort port, System.Net.Sockets.ProtocolType protocol, byte ttl, byte[] data) { System.Net.IPEndPoint remoteipep; try { remoteipep = new System.Net.IPEndPoint(ipaddr, port); this.socket = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Raw, protocol); this.socket.SetSocketOption(System.Net.Sockets.SocketOptionLevel.IP, System.Net.Sockets.SocketOptionName.IpTimeToLive, ttl); // in case of broadcast if (this.b_allow_broadcast) { this.socket.SetSocketOption(System.Net.Sockets.SocketOptionLevel.Socket, System.Net.Sockets.SocketOptionName.Broadcast, 1); } if (System.BitConverter.ToUInt32(ipaddr.GetAddressBytes(), 0) == 0xFFFFFFFF) { this.socket.SendTo(data, 0, data.Length, System.Net.Sockets.SocketFlags.DontRoute, remoteipep); } else { this.socket.SendTo(data, remoteipep); } } catch (Exception e) { // send event_Socket_Error if (this.event_Socket_Error != null) { this.event_Socket_Error(this, new EventArgs_Exception(e)); } // close socket this.close_clt_socket(); } }
public void Connect(string server, int port, string user, string pass, System.Net.Sockets.ProtocolType proto) { if (conn != null) { conn.Connect(server, port, user, pass, proto); } }
public void PushSystemNetSocketsProtocolType(RealStatePtr L, System.Net.Sockets.ProtocolType val) { if (SystemNetSocketsProtocolType_TypeID == -1) { bool is_first; SystemNetSocketsProtocolType_TypeID = getTypeId(L, typeof(System.Net.Sockets.ProtocolType), out is_first); if (SystemNetSocketsProtocolType_EnumRef == -1) { Utils.LoadCSTable(L, typeof(System.Net.Sockets.ProtocolType)); SystemNetSocketsProtocolType_EnumRef = LuaAPI.luaL_ref(L, LuaIndexes.LUA_REGISTRYINDEX); } } if (LuaAPI.xlua_tryget_cachedud(L, (int)val, SystemNetSocketsProtocolType_EnumRef) == 1) { return; } IntPtr buff = LuaAPI.xlua_pushstruct(L, 4, SystemNetSocketsProtocolType_TypeID); if (!CopyByValue.Pack(buff, 0, (int)val)) { throw new Exception("pack fail fail for System.Net.Sockets.ProtocolType ,value=" + val); } LuaAPI.lua_getref(L, SystemNetSocketsProtocolType_EnumRef); LuaAPI.lua_pushvalue(L, -2); LuaAPI.xlua_rawseti(L, -2, (int)val); LuaAPI.lua_pop(L, 1); }
/// <summary> /// Retrieves the Latitude and Longitude Information from a Airlink Modem /// </summary> /// <param name="messengerSession">The messengerSession to perform the transaction on</param> /// <returns>A Variable indicating the Latitude and Longitude of the modem</returns> public static List <Variable> GetLatitudeLongitude(SnmpMessenger messengerSession) { PmppEndPoint?old = null; int oldV = messengerSession.SnmpVersion; System.Net.Sockets.ProtocolType oldType = messengerSession.TrasnportProtocol; if (messengerSession.PmppEndPoint.HasValue) { old = messengerSession.PmppEndPoint; messengerSession.PmppEndPoint = null; } List <string> objects = new List <string>() { "1.3.6.1.4.1.20542.4.3.0", //latitude "1.3.6.1.4.1.20542.4.4.0" //longitude }; messengerSession.TrasnportProtocol = System.Net.Sockets.ProtocolType.Udp; messengerSession.SnmpVersion = 2; List <Variable> results = messengerSession.Get(objects).Bindings; if (old.HasValue) { messengerSession.PmppEndPoint = old; } messengerSession.TrasnportProtocol = oldType; messengerSession.SnmpVersion = oldV; return(results); }
public InternetEndPoint(int port, System.Net.Sockets.AddressFamily addressFamily, System.Net.Sockets.ProtocolType protocolType, System.Net.Sockets.ProtocolFamily protocolFamily) : base(protocolType, protocolFamily) { if (port < System.Net.IPEndPoint.MinPort || port > System.Net.IPEndPoint.MaxPort) { throw new System.ArgumentOutOfRangeException("port"); } m_Port = port; }
public void WrongProtocol() { //Prepare const Int32 PORT = 111; const System.Net.Sockets.ProtocolType PROTOCOL = System.Net.Sockets.ProtocolType.Icmp; //Act var result = NetworkHelpers.GetKnownPort(PORT, PROTOCOL); //Assert Assert.Fail(); }
public void PortFoundButUnassigned() { //Prepare const Int32 PORT = 4; const System.Net.Sockets.ProtocolType PROTOCOL = System.Net.Sockets.ProtocolType.Udp; //Act var result = NetworkHelpers.GetKnownPort(PORT, PROTOCOL); //Assert Assert.IsNull(result); }
public StandardSocket(System.Net.Sockets.AddressFamily addressFamily, System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType, System.Net.EndPoint localEndPoint) { if (localEndPoint == null) { throw new ArgumentNullException("localEndPoint"); } socket = new System.Net.Sockets.Socket(addressFamily, socketType, protocolType); this.localEndPoint = localEndPoint; }
private static void TrySockets() { System.Net.Sockets.AddressFamily AddressFamily_Bluetooth = (System.Net.Sockets.AddressFamily) 32; // #define BTHPROTO_RFCOMM 0x0003 // #define BTHPROTO_L2CAP 0x0100 System.Net.Sockets.ProtocolType ProtocolType_Rfcomm = (System.Net.Sockets.ProtocolType) 0x0003; System.Net.Sockets.ProtocolType ProtocolType_L2Cap = (System.Net.Sockets.ProtocolType) 0x0100; System.Net.Sockets.Socket sckRfcomm = new System.Net.Sockets.Socket( AddressFamily_Bluetooth, System.Net.Sockets.SocketType.Stream, ProtocolType_Rfcomm); System.Net.Sockets.Socket sckL2Cap = new System.Net.Sockets.Socket( AddressFamily_Bluetooth, System.Net.Sockets.SocketType.Stream, ProtocolType_L2Cap); }
public void PortFound() { //Prepare const Int32 PORT = 1433; const System.Net.Sockets.ProtocolType PROTOCOL = System.Net.Sockets.ProtocolType.Tcp; //Act var result = NetworkHelpers.GetKnownPort(PORT, PROTOCOL); //Assert Assert.IsNotNull(result); Assert.AreEqual(PORT, result.Port); Assert.AreEqual(PROTOCOL, result.Protocol); }
public InternetEndPoint(int port, System.Net.Sockets.AddressFamily addressFamily, System.Net.SocketAddress socketAddress, System.Net.Sockets.ProtocolType protocolType, System.Net.Sockets.ProtocolFamily protocolFamily) : this(port, addressFamily, protocolType, protocolFamily) { if (socketAddress == null) { throw new System.ArgumentNullException("socketAddress"); } if (false.Equals(socketAddress.Family == AddressFamily)) { throw new System.InvalidOperationException("AddressFamily must match the socketAddress.Family"); } SocketAddress = socketAddress; }
static int InitSession(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 3) { Protocols.NetworkController obj = (Protocols.NetworkController)ToLua.CheckObject <Protocols.NetworkController>(L, 1); string arg0 = ToLua.CheckString(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int o = obj.InitSession(arg0, arg1); LuaDLL.lua_pushinteger(L, o); return(1); } else if (count == 4) { Protocols.NetworkController obj = (Protocols.NetworkController)ToLua.CheckObject <Protocols.NetworkController>(L, 1); string arg0 = ToLua.CheckString(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); System.Net.Sockets.ProtocolType arg2 = (System.Net.Sockets.ProtocolType)ToLua.CheckObject(L, 4, typeof(System.Net.Sockets.ProtocolType)); int o = obj.InitSession(arg0, arg1, arg2); LuaDLL.lua_pushinteger(L, o); return(1); } else if (count == 5) { Protocols.NetworkController obj = (Protocols.NetworkController)ToLua.CheckObject <Protocols.NetworkController>(L, 1); string arg0 = ToLua.CheckString(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); System.Net.Sockets.ProtocolType arg2 = (System.Net.Sockets.ProtocolType)ToLua.CheckObject(L, 4, typeof(System.Net.Sockets.ProtocolType)); bool arg3 = LuaDLL.luaL_checkboolean(L, 5); int o = obj.InitSession(arg0, arg1, arg2, arg3); LuaDLL.lua_pushinteger(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: Protocols.NetworkController.InitSession")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Net.Sockets.ProtocolType proto = (System.Net.Sockets.ProtocolType) typeof(System.Net.Sockets.ProtocolType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Net.Sockets.SocketType type = (System.Net.Sockets.SocketType) typeof(System.Net.Sockets.SocketType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.Net.Sockets.AddressFamily family = (System.Net.Sockets.AddressFamily) typeof(System.Net.Sockets.AddressFamily).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = new System.Net.Sockets.Socket(family, type, proto); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
public DnsEndPoint(string host, int port, System.Net.Sockets.AddressFamily addressFamily, System.Net.Sockets.ProtocolType protocolType, System.Net.Sockets.ProtocolFamily protocolFamily) : base(port, addressFamily, protocolType, protocolFamily) { if (string.IsNullOrWhiteSpace(host)) { throw new System.ArgumentException("Cannot be null or consist only of whitespace", "host"); } if (false.Equals(m_Family == System.Net.Sockets.AddressFamily.InterNetwork) && false.Equals(m_Family == System.Net.Sockets.AddressFamily.InterNetworkV6)) { throw new System.ArgumentException("Invalid Address Family", "addressFamily"); } m_Host = host; m_Family = addressFamily; }
public void UpdateSystemNetSocketsProtocolType(RealStatePtr L, int index, System.Net.Sockets.ProtocolType val) { if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA) { if (LuaAPI.xlua_gettypeid(L, index) != SystemNetSocketsProtocolType_TypeID) { throw new Exception("invalid userdata for System.Net.Sockets.ProtocolType"); } IntPtr buff = LuaAPI.lua_touserdata(L, index); if (!CopyByValue.Pack(buff, 0, (int)val)) { throw new Exception("pack fail for System.Net.Sockets.ProtocolType ,value=" + val); } } else { throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index)); } }
public CSADDR_INFO(BluetoothAddress local, BluetoothAddress remote, System.Net.Sockets.SocketType type, System.Net.Sockets.ProtocolType protocol) { //ensure zeros localAddr = IntPtr.Zero; localSize = 0; remoteAddr = IntPtr.Zero; remoteSize = 0; iSocketType = type; iProtocol = protocol; if (local != null) { #if V1 //have to use AllocHGlobal substitute localAddr = Marshal32.AllocHGlobal(40); Marshal.Copy(local.ToByteArray(), 0, new IntPtr(localAddr.ToInt32() + 8), 6); #else localAddr = Marshal.AllocHGlobal(40); Marshal.WriteInt64(localAddr, 8, local.ToInt64()); #endif Marshal.WriteInt16(localAddr, 0, 32); localSize = 40; } if (remote != null) { #if V1 remoteAddr = Marshal32.AllocHGlobal(40); Marshal.Copy(remote.ToByteArray(), 0, new IntPtr(remoteAddr.ToInt32() + 8), 6); #else remoteAddr = Marshal.AllocHGlobal(40); Marshal.WriteInt64(remoteAddr, 8, remote.ToInt64()); #endif remoteSize = 40; Marshal.WriteInt16(remoteAddr, 0, 32); } }
public static bool _ctor_System_Net_Sockets_Socket_System_Net_Sockets_AddressFamily_System_Net_Sockets_SocketType_System_Net_Sockets_ProtocolType( ) { //Parameters System.Net.Sockets.AddressFamily addressFamily = null; System.Net.Sockets.SocketType socketType = null; System.Net.Sockets.ProtocolType protocolType = null; //Exception Exception exception_Real = null; Exception exception_Intercepted = null; InterceptionMaintenance.disableInterception( ); try { returnValue_Real = System.Net.Sockets.Socket.ctor(addressFamily, socketType, protocolType); } catch (Exception e) { exception_Real = e; } InterceptionMaintenance.enableInterception( ); try { returnValue_Intercepted = System.Net.Sockets.Socket.ctor(addressFamily, socketType, protocolType); } catch (Exception e) { exception_Intercepted = e; } }
public static FileDescriptor socket0(bool preferIPv6, bool stream, bool reuse) { #if FIRST_PASS return(null); #else try { System.Net.Sockets.AddressFamily addressFamily = preferIPv6 ? System.Net.Sockets.AddressFamily.InterNetworkV6 : System.Net.Sockets.AddressFamily.InterNetwork; System.Net.Sockets.SocketType socketType = stream ? System.Net.Sockets.SocketType.Stream : System.Net.Sockets.SocketType.Dgram; System.Net.Sockets.ProtocolType protocolType = stream ? System.Net.Sockets.ProtocolType.Tcp : System.Net.Sockets.ProtocolType.Udp; System.Net.Sockets.Socket socket = new System.Net.Sockets.Socket(addressFamily, socketType, protocolType); if (preferIPv6) { // enable IPv4 over IPv6 sockets (note that we don't have to check for >= Vista here, because nio sockets only support IPv6 on >= Vista) const System.Net.Sockets.SocketOptionName IPV6_V6ONLY = (System.Net.Sockets.SocketOptionName) 27; socket.SetSocketOption(System.Net.Sockets.SocketOptionLevel.IPv6, IPV6_V6ONLY, 0); } if (!stream) { setConnectionReset(socket, false); } FileDescriptor fd = new FileDescriptor(); fd.setSocket(socket); return(fd); } catch (System.Net.Sockets.SocketException x) { throw global::java.net.SocketUtil.convertSocketExceptionToIOException(x); } #endif }
private Socket(SafeCloseSocket fd) { this.willBlock = true; this.willBlockInternal = true; this.m_CloseTimeout = -1; s_LoggingEnabled = Logging.On; if (s_LoggingEnabled) { Logging.Enter(Logging.Sockets, this, "Socket", (string) null); } InitializeSockets(); if ((fd == null) || fd.IsInvalid) { throw new ArgumentException(SR.GetString("net_InvalidSocketHandle")); } this.m_Handle = fd; this.addressFamily = System.Net.Sockets.AddressFamily.Unknown; this.socketType = System.Net.Sockets.SocketType.Unknown; this.protocolType = System.Net.Sockets.ProtocolType.Unknown; if (s_LoggingEnabled) { Logging.Exit(Logging.Sockets, this, "Socket", (string) null); } }
public void Get(RealStatePtr L, int index, out System.Net.Sockets.ProtocolType val) { LuaTypes type = LuaAPI.lua_type(L, index); if (type == LuaTypes.LUA_TUSERDATA) { if (LuaAPI.xlua_gettypeid(L, index) != SystemNetSocketsProtocolType_TypeID) { throw new Exception("invalid userdata for System.Net.Sockets.ProtocolType"); } IntPtr buff = LuaAPI.lua_touserdata(L, index); int e; if (!CopyByValue.UnPack(buff, 0, out e)) { throw new Exception("unpack fail for System.Net.Sockets.ProtocolType"); } val = (System.Net.Sockets.ProtocolType)e; } else { val = (System.Net.Sockets.ProtocolType)objectCasters.GetCaster(typeof(System.Net.Sockets.ProtocolType))(L, index, null); } }
public Socket(System.Net.Sockets.AddressFamily addressFamily, System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType) { }
public static bool ConnectAsync(System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType, System.Net.Sockets.SocketAsyncEventArgs e) { return(default(bool)); }
public static int FindOpenPort(System.Net.Sockets.ProtocolType type, int start = 30000, bool even = true) { //Only Tcp or Udp :) if (type != System.Net.Sockets.ProtocolType.Udp && type != System.Net.Sockets.ProtocolType.Tcp) { return(-1); } int port = start; //Get the IpGlobalProperties System.Net.NetworkInformation.IPGlobalProperties ipGlobalProperties = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties(); //Can't get any information if (ipGlobalProperties == null) { return(port = -1); } //We need endpoints to ensure the ports we want are not in use System.Collections.Generic.IEnumerable <System.Net.IPEndPoint> listeners = System.Linq.Enumerable.Empty <System.Net.IPEndPoint>(); switch (type) { case System.Net.Sockets.ProtocolType.Udp: listeners = ipGlobalProperties.GetActiveUdpListeners(); break; case System.Net.Sockets.ProtocolType.Tcp: listeners = ipGlobalProperties.GetActiveTcpListeners(); break; default: throw new System.NotSupportedException("The given ProtocolType is not supported"); } //Enumerate the ones that are = or > then port and increase port along the way foreach (System.Net.IPEndPoint ep in listeners) { if (ep.Port <= port) { continue; } if (port == ep.Port) { port++; } else if (ep.Port == port + 1) { port += 2; } } //If we only want even ports and we found an even one return it if (even && Binary.IsEven(port) || false == even && Binary.IsOdd(port)) { return(port); } //We found an even and we wanted odd or vice versa return(++port); }
public static System.Net.Sockets.Socket ReservePort(System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocol, System.Net.IPAddress localIp, int port) { System.Net.Sockets.Socket result = new System.Net.Sockets.Socket(localIp.AddressFamily, socketType, protocol); result.SetSocketOption(System.Net.Sockets.SocketOptionLevel.Socket, System.Net.Sockets.SocketOptionName.ReuseAddress, true); result.Bind(new System.Net.IPEndPoint(localIp, port)); return(result); }
protected virtual System.Net.Sockets.Socket CreateSocket(System.Net.Sockets.AddressFamily addressFamily, System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType, System.Net.EndPoint?endPoint, System.Net.Connections.IConnectionProperties?options) { throw null; }
public SocketsConnectionFactory(System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType) { }
public unsafe Socket(SocketInformation socketInformation) { this.willBlock = true; this.willBlockInternal = true; this.m_CloseTimeout = -1; s_LoggingEnabled = Logging.On; if (s_LoggingEnabled) { Logging.Enter(Logging.Sockets, this, "Socket", this.addressFamily); } ExceptionHelper.UnrestrictedSocketPermission.Demand(); InitializeSockets(); if ((socketInformation.ProtocolInformation == null) || (socketInformation.ProtocolInformation.Length < protocolInformationSize)) { throw new ArgumentException(SR.GetString("net_sockets_invalid_socketinformation"), "socketInformation.ProtocolInformation"); } fixed (byte* numRef = socketInformation.ProtocolInformation) { this.m_Handle = SafeCloseSocket.CreateWSASocket(numRef); UnsafeNclNativeMethods.OSSOCK.WSAPROTOCOL_INFO wsaprotocol_info = (UnsafeNclNativeMethods.OSSOCK.WSAPROTOCOL_INFO) Marshal.PtrToStructure((IntPtr) numRef, typeof(UnsafeNclNativeMethods.OSSOCK.WSAPROTOCOL_INFO)); this.addressFamily = wsaprotocol_info.iAddressFamily; this.socketType = (System.Net.Sockets.SocketType) wsaprotocol_info.iSocketType; this.protocolType = (System.Net.Sockets.ProtocolType) wsaprotocol_info.iProtocol; } if (this.m_Handle.IsInvalid) { SocketException exception = new SocketException(); if (exception.ErrorCode == 0x2726) { throw new ArgumentException(SR.GetString("net_sockets_invalid_socketinformation"), "socketInformation"); } throw exception; } if ((this.addressFamily != System.Net.Sockets.AddressFamily.InterNetwork) && (this.addressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6)) { throw new NotSupportedException(SR.GetString("net_invalidversion")); } this.m_IsConnected = socketInformation.IsConnected; this.willBlock = !socketInformation.IsNonBlocking; this.InternalSetBlocking(this.willBlock); this.isListening = socketInformation.IsListening; this.UseOnlyOverlappedIO = socketInformation.UseOnlyOverlappedIO; if (socketInformation.RemoteEndPoint != null) { this.m_RightEndPoint = socketInformation.RemoteEndPoint; this.m_RemoteEndPoint = socketInformation.RemoteEndPoint; } else { SocketError notSocket; EndPoint any = null; if (this.addressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { any = IPEndPoint.Any; } else if (this.addressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6) { any = IPEndPoint.IPv6Any; } SocketAddress socketAddress = any.Serialize(); try { notSocket = UnsafeNclNativeMethods.OSSOCK.getsockname(this.m_Handle, socketAddress.m_Buffer, ref socketAddress.m_Size); } catch (ObjectDisposedException) { notSocket = SocketError.NotSocket; } if (notSocket == SocketError.Success) { try { this.m_RightEndPoint = any.Create(socketAddress); } catch { } } } if (s_LoggingEnabled) { Logging.Exit(Logging.Sockets, this, "Socket", (string) null); } }
public Socket(System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType) { }
public static bool ConnectAsync(System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType, System.Net.Sockets.SocketAsyncEventArgs e) { throw null; }
public Socket(System.Net.Sockets.AddressFamily addressFamily, System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType) { this.willBlock = true; this.willBlockInternal = true; this.m_CloseTimeout = -1; s_LoggingEnabled = Logging.On; if (s_LoggingEnabled) { Logging.Enter(Logging.Sockets, this, "Socket", addressFamily); } InitializeSockets(); this.m_Handle = SafeCloseSocket.CreateWSASocket(addressFamily, socketType, protocolType); if (this.m_Handle.IsInvalid) { throw new SocketException(); } this.addressFamily = addressFamily; this.socketType = socketType; this.protocolType = protocolType; IPProtectionLevel iPProtectionLevel = SettingsSectionInternal.Section.IPProtectionLevel; if (iPProtectionLevel != IPProtectionLevel.Unspecified) { this.SetIPProtectionLevel(iPProtectionLevel); } if (s_LoggingEnabled) { Logging.Exit(Logging.Sockets, this, "Socket", (string) null); } }