Código HTML:
public class CSocket { private string address; private int port; public string Address { get { return address; } set { address = value; } } public int Port { get { return port; } set { port = value; } } public CSocket() { this.address = ""; this.port = 0; } public CSocket(string address, int port) { this.address = address; this.port = port; } private static Socket ConnectSocket() { IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(Address), Port); Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); server.Connect(ipep);//Intentamos conectar el socket if (server.Connected) return server; return null; } }
Pero en la línea: IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(Address), Port); me dice que Address y Port nedesitan ser referenciados por un objeto, pero si yo accedo a ellos por get y set porqué me da ese error?