use string for IP adresses instead of explicit type
This commit is contained in:
@@ -12,7 +12,7 @@ namespace PolyChat
|
|||||||
{
|
{
|
||||||
public class Controller
|
public class Controller
|
||||||
{
|
{
|
||||||
public static IPAddress ip;
|
public static string ip;
|
||||||
private MainPage UIController;
|
private MainPage UIController;
|
||||||
|
|
||||||
private ClientHandler clientHandler;
|
private ClientHandler clientHandler;
|
||||||
@@ -93,11 +93,16 @@ namespace PolyChat
|
|||||||
Console.WriteLine($"Message received from {socket.GetHashCode()}:{message.Data[0]}");
|
Console.WriteLine($"Message received from {socket.GetHashCode()}:{message.Data[0]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
static IPAddress[] GetIPs()
|
static string[] GetIPs()
|
||||||
{
|
{
|
||||||
IPHostEntry ipEntry = Dns.GetHostEntry(Dns.GetHostName());
|
IPHostEntry ipEntry = Dns.GetHostEntry(Dns.GetHostName());
|
||||||
IPAddress[] addr = ipEntry.AddressList;
|
IPAddress[] addr = ipEntry.AddressList;
|
||||||
return addr;
|
string[] ips = new string[addr.Length];
|
||||||
|
for (int i=0; i<addr.Length; i++)
|
||||||
|
{
|
||||||
|
ips[i] = addr.ToString();
|
||||||
|
}
|
||||||
|
return ips;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ namespace PolyChat.Models
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MSG
|
public class MSG
|
||||||
{
|
{
|
||||||
public String sender = "unknown";
|
public string sender = "unknown";
|
||||||
public DateTime timestamp = new DateTime(2000, 01, 01);
|
public DateTime timestamp = new DateTime(2000, 01, 01);
|
||||||
public String msg = "empty";
|
public string msg = "empty";
|
||||||
public IPAddress ip = new IPAddress(new byte[] { 49,48,46,49,46,50,49,49,46,50,54 });
|
public string ip;
|
||||||
|
|
||||||
|
|
||||||
public MSG(String sender, IPAddress ip, String msg, DateTime timestamp)
|
public MSG(string sender, string ip, String msg, DateTime timestamp)
|
||||||
{
|
{
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
|
|||||||
Reference in New Issue
Block a user