| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using System;
- using System.Net;
- namespace ENet
- {
- public struct Address
- {
- private uint ip;
- private ushort port;
- public uint Ip
- {
- get
- {
- return this.ip;
- }
- set
- {
- this.ip = value;
- }
- }
- public ushort Port
- {
- get
- {
- return this.port;
- }
- set
- {
- this.port = value;
- }
- }
- public string HostName
- {
- get
- {
- var hostInfo = Dns.GetHostEntry(new IPAddress(this.ip));
- return hostInfo.HostName;
- }
- set
- {
- IPAddress[] addresslist = Dns.GetHostAddresses(value);
- foreach (IPAddress address in addresslist)
- {
- this.ip = BitConverter.ToUInt32(address.GetAddressBytes(), 0);
- return;
- }
- }
- }
- public ENetAddress Struct
- {
- get
- {
- var address = new ENetAddress { host = this.ip, port = this.port };
- return address;
- }
- }
- }
- }
|