Beispiel #1
0
        public string GetIP()
        {
            StringBuilder ip = new StringBuilder(1024);

            if (Native.enet_address_get_host_ip(nativeAddress, ip, (IntPtr)ip.Capacity) != 0)
            {
                return(String.Empty);
            }

            return(ip.ToString());
        }
        public string GetHostIp()
        {
            StringBuilder sb = new StringBuilder(255);

            if (Native.enet_address_get_host_ip(ref nativeAddress, sb, sb.Capacity) != 0)
            {
                return(null);
            }

            return(sb.ToString());
        }
Beispiel #3
0
        public string GetIP()
        {
            byte[] data = new byte[256];

            if (Native.enet_address_get_host_ip(ref nativeAddress, data, (IntPtr)256) == 0)
            {
                return(Encoding.ASCII.GetString(data));
            }
            else
            {
                return(String.Empty);
            }
        }
Beispiel #4
0
        public string GetHostIP()
        {
            var ip = new byte[256];

            fixed(byte *hostIP = ip)
            {
                if (Native.enet_address_get_host_ip(ref _address, hostIP, (IntPtr)ip.Length) < 0)
                {
                    return(null);
                }
            }

            return(BytesToString(ip));
        }