diff --git a/Facepunch.Steamworks/Structs/NetAddress.cs b/Facepunch.Steamworks/Structs/NetAddress.cs
index 0f1b172..7add599 100644
--- a/Facepunch.Steamworks/Structs/NetAddress.cs
+++ b/Facepunch.Steamworks/Structs/NetAddress.cs
@@ -1,4 +1,5 @@
-using System.Runtime.InteropServices;
+using System.Net;
+using System.Runtime.InteropServices;
namespace Steamworks.Data
{
@@ -26,6 +27,28 @@ internal struct IPV4
/// Any IP, specific port
///
public static NetAddress AnyIp( ushort port )
+ {
+ return new NetAddress
+ {
+ ip = new IPV4
+ {
+ m_8zeros = 0,
+ m_0000 = 0,
+ m_ffff = 0,
+ ip0 = 0,
+ ip1 = 0,
+ ip2 = 0,
+ ip3 = 0,
+ },
+
+ port = port
+ };
+ }
+
+ ///
+ /// Localhost IP, specific port
+ ///
+ public static NetAddress LocalHost( ushort port )
{
return new NetAddress
{
@@ -43,5 +66,42 @@ public static NetAddress AnyIp( ushort port )
port = port
};
}
+
+ ///
+ /// Specific IP, specific port
+ ///
+ public static NetAddress From( string addrStr, ushort port )
+ {
+ return From( IPAddress.Parse( addrStr ), port );
+ }
+
+ ///
+ /// Specific IP, specific port
+ ///
+ public static NetAddress From( IPAddress address, ushort port )
+ {
+ var addr = address.GetAddressBytes();
+
+ if ( addr.Length == 4 )
+ {
+ return new NetAddress
+ {
+ ip = new IPV4
+ {
+ m_8zeros = 0,
+ m_0000 = 0,
+ m_ffff = 0xffff,
+ ip0 = addr[0],
+ ip1 = addr[1],
+ ip2 = addr[2],
+ ip3 = addr[3],
+ },
+
+ port = port
+ };
+ }
+
+ throw new System.NotImplementedException( "Oops - no IPV6 support yet?" );
+ }
}
-}
\ No newline at end of file
+}