fix ip in intial packet (send own ip, not foreign)
This commit is contained in:
@@ -65,6 +65,7 @@ namespace PolyChat
|
|||||||
{
|
{
|
||||||
Debug.WriteLine("--- initial packet received ---");
|
Debug.WriteLine("--- initial packet received ---");
|
||||||
string ForeignIp = data[0].ToString();
|
string ForeignIp = data[0].ToString();
|
||||||
|
Debug.WriteLine($"--- this ip was in the inital packet: {ForeignIp} ---");
|
||||||
if (isInConnections(ForeignIp))
|
if (isInConnections(ForeignIp))
|
||||||
{
|
{
|
||||||
Debug.WriteLine("---- We have an active connection to this client. ABORT! ----");//Todo show error!
|
Debug.WriteLine("---- We have an active connection to this client. ABORT! ----");//Todo show error!
|
||||||
@@ -128,7 +129,7 @@ namespace PolyChat
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string getIP()
|
public static string getIP()
|
||||||
{
|
{
|
||||||
IPHostEntry ipEntry = Dns.GetHostEntry(Dns.GetHostName());
|
IPHostEntry ipEntry = Dns.GetHostEntry(Dns.GetHostName());
|
||||||
IPAddress[] addrList = ipEntry.AddressList;
|
IPAddress[] addrList = ipEntry.AddressList;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace PolyChat.Models
|
|||||||
private void OnConnect()
|
private void OnConnect()
|
||||||
{
|
{
|
||||||
Debug.WriteLine("--- Sending initial packet to server ---");
|
Debug.WriteLine("--- Sending initial packet to server ---");
|
||||||
Client.Emit("initial", IP);
|
Client.Emit("initial", Controller.getIP());
|
||||||
Debug.WriteLine("--- Connection successfull ---");
|
Debug.WriteLine("--- Connection successfull ---");
|
||||||
Connected = true;
|
Connected = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user