27 lines
649 B
C#
27 lines
649 B
C#
|
|
using System;
|
|
|
|
namespace Network {
|
|
public class Connection {
|
|
|
|
private static int IDCounter = 0;
|
|
public readonly int ID = IDCounter++;
|
|
public string Name;
|
|
public string Address;
|
|
public int Port;
|
|
|
|
public Connection(string address, int port) {
|
|
Name = "Connection-" + ID;
|
|
Address = address;
|
|
Port = port;
|
|
}
|
|
|
|
public bool Equals(Connection other) {
|
|
return other.Address == Address && other.Port == Port;
|
|
}
|
|
|
|
public override string ToString() {
|
|
return "Connection #" + ID + " (" + Name + ")";
|
|
}
|
|
}
|
|
} |