Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/07/2008, 08:25
ZeroZ
 
Fecha de Ingreso: junio-2002
Ubicación: España
Mensajes: 348
Antigüedad: 22 años, 9 meses
Puntos: 8
Error al referenciar objetos de la misma clase

Hola, quiero hacer una clase para manejar los sockets:

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?
__________________
Bicis nuevas y de segunda mano: Bicibid