]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/ftp.cpp
Allow user code to override key events in generic wxListCtrl.
[wxWidgets.git] / src / common / ftp.cpp
index b1761ba38720d77ae9135a885f6f10ffa67d0666..49cba58de659abfb04abf2daca185caf1418268c 100644 (file)
@@ -155,11 +155,15 @@ bool wxFTP::Connect(const wxSockAddress& addr, bool WXUNUSED(wait))
     return true;
 }
 
-bool wxFTP::Connect(const wxString& host)
+bool wxFTP::Connect(const wxString& host, unsigned short port)
 {
     wxIPV4address addr;
     addr.Hostname(host);
-    addr.Service(wxT("ftp"));
+
+    if ( port )
+        addr.Service(port);
+    else if (!addr.Service(wxT("ftp")))
+        addr.Service(21);
 
     return Connect(addr);
 }
@@ -199,8 +203,7 @@ wxSocketBase *wxFTP::AcceptIfActive(wxSocketBase *sock)
     {
         m_lastError = wxPROTO_CONNERR;
         wxLogError(_("Timeout while waiting for FTP server to connect, try passive mode."));
-        delete sock;
-        sock = NULL;
+        wxDELETE(sock);
     }
     else
     {