示例#1
0
        public static NetAddress LocalHost(ushort port)
        {
            NetAddress netAddress = new NetAddress();

            NetAddress.IPV4 pV4 = new NetAddress.IPV4()
            {
                m_8zeros = (ulong)0,
                m_0000   = 0,
                m_ffff   = 0,
                ip0      = 0,
                ip1      = 0,
                ip2      = 0,
                ip3      = 1
            };
            netAddress.ip   = pV4;
            netAddress.port = port;
            return(netAddress);
        }
示例#2
0
        public static NetAddress From(IPAddress address, ushort port)
        {
            byte[] addressBytes = address.GetAddressBytes();
            if ((int)addressBytes.Length != 4)
            {
                throw new NotImplementedException("Oops - no IPV6 support yet?");
            }
            NetAddress netAddress = new NetAddress();

            NetAddress.IPV4 pV4 = new NetAddress.IPV4()
            {
                m_8zeros = (ulong)0,
                m_0000   = 0,
                m_ffff   = 65535,
                ip0      = addressBytes[0],
                ip1      = addressBytes[1],
                ip2      = addressBytes[2],
                ip3      = addressBytes[3]
            };
            netAddress.ip   = pV4;
            netAddress.port = port;
            return(netAddress);
        }
 internal static extern void InternalToString(ref NetAddress self, IntPtr buf, uint cbBuf, [MarshalAs(UnmanagedType.U1)] bool bWithPort);
 internal static extern bool InternalIsLocalHost(ref NetAddress self);
 internal static extern void InternalSetIPv6LocalHost(ref NetAddress self, ushort nPort);
 internal static extern uint InternalGetIPv4(ref NetAddress self);
 internal static extern bool InternalIsIPv4(ref NetAddress self);
 internal static extern void InternalSetIPv4(ref NetAddress self, uint nIP, ushort nPort);
示例#9
0
 internal static extern bool InternalIsFakeIP(ref NetAddress self);
 internal static extern bool InternalIsIPv6AllZeros(ref NetAddress self);
 internal static extern void InternalClear(ref NetAddress self);
 internal static extern void InternalSetIPAddr(ref NetIdentity self, ref NetAddress addr);
示例#13
0
 public static NetAddress From(string addrStr, ushort port)
 {
     return(NetAddress.From(IPAddress.Parse(addrStr), port));
 }
 internal static extern bool InternalParseString(ref NetAddress self, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string pszStr);
 internal static extern void InternalSetIPv6(ref NetAddress self, ref byte ipv6, ushort nPort);
 internal static extern bool InternalIsEqualTo(ref NetAddress self, ref NetAddress x);
示例#17
0
 internal static extern SteamNetworkingFakeIPType InternalGetFakeIPType(ref NetAddress self);