|
|
@@ -137,6 +137,22 @@ namespace ENet {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ 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 bool SetIP(string ip) {
|
|
|
+ if (ip == null)
|
|
|
+ throw new ArgumentNullException("ip");
|
|
|
+
|
|
|
+ return Native.enet_address_set_host_ip(ref nativeAddress, ip) == 0;
|
|
|
+ }
|
|
|
+
|
|
|
public string GetHost() {
|
|
|
StringBuilder hostName = new StringBuilder(1024);
|
|
|
|
|
|
@@ -838,7 +854,7 @@ namespace ENet {
|
|
|
public const uint timeoutLimit = 32;
|
|
|
public const uint timeoutMinimum = 5000;
|
|
|
public const uint timeoutMaximum = 30000;
|
|
|
- public const uint version = (2 << 16) | (2 << 8) | (4);
|
|
|
+ public const uint version = (2 << 16) | (2 << 8) | (5);
|
|
|
|
|
|
public static bool Initialize() {
|
|
|
return Native.enet_initialize() == 0;
|
|
|
@@ -880,11 +896,17 @@ namespace ENet {
|
|
|
internal static extern uint enet_time_get();
|
|
|
|
|
|
[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
|
|
|
- internal static extern int enet_address_get_host(ENetAddress address, StringBuilder hostName, IntPtr nameLength);
|
|
|
+ internal static extern int enet_address_set_host_ip(ref ENetAddress address, string ip);
|
|
|
|
|
|
[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
|
|
|
internal static extern int enet_address_set_host(ref ENetAddress address, string hostName);
|
|
|
|
|
|
+ [DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
|
|
|
+ internal static extern int enet_address_get_host_ip(ENetAddress address, StringBuilder ip, IntPtr ipLength);
|
|
|
+
|
|
|
+ [DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
|
|
|
+ internal static extern int enet_address_get_host(ENetAddress address, StringBuilder hostName, IntPtr nameLength);
|
|
|
+
|
|
|
[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
|
|
|
internal static extern IntPtr enet_packet_create(byte[] data, IntPtr dataLength, PacketFlags flags);
|
|
|
|