fix ip in intial packet (send own ip, not foreign)

This commit is contained in:
Felix Hartmann (PEA3-Fe-FI)
2021-09-23 09:52:54 +02:00
parent cd26ac11c3
commit c22987d86f
2 changed files with 3 additions and 2 deletions

View File

@@ -65,6 +65,7 @@ namespace PolyChat
{
Debug.WriteLine("--- initial packet received ---");
string ForeignIp = data[0].ToString();
Debug.WriteLine($"--- this ip was in the inital packet: {ForeignIp} ---");
if (isInConnections(ForeignIp))
{
Debug.WriteLine("---- We have an active connection to this client. ABORT! ----");//Todo show error!
@@ -128,7 +129,7 @@ namespace PolyChat
return false;
}
public string getIP()
public static string getIP()
{
IPHostEntry ipEntry = Dns.GetHostEntry(Dns.GetHostName());
IPAddress[] addrList = ipEntry.AddressList;