Friday, March 11, 2005

Do any developers read this?

I am designing the classes for my ftp client, and want some input.

I am creating an FTP connection class. This class will represent the physical connection between the server and my client. What properties should I keep in the class?

Right now, I have the Socket object I send commands through, and a flag to show whether it is connected. Is there anything else I need?

Here's the code right now:


public class FTPConnection
{

     private bool _Connected;
     private Socket _CmdSocket;
     private IPEndPoint _RemoteServer;


     public IPEndPoint RemoteServer
     {
          get{ return _RemoteServer; }
          set{ _RemoteServer = value; }
     }

     public bool Connected
     {
          get
          {
               _Connected = CmdSocket.Connected;
               return _Connected;
          }
          set{ _Connected = value; }
     }

     public Socket CmdSocket
     {
          get{ return _CmdSocket; }
          set{ _CmdSocket = value; }
     }

     public FTPConnection()
     {
          ...
     }

     public bool Connect( )
     {
          ...
     }
}

No comments: