2 * (c) Oleg Puchinin 2008
3 * graycardinalster@gmail.com
10 #include <gc_network.h>
14 const char * lpsz_typeI
= "TYPE I\r\n";
19 m_dataConnection
= NULL
;
22 FTP::FTP (bool passive
)
25 m_dataConnection
= NULL
;
33 List
* FTP::waitReply ()
50 int FTP::connect (char * server
, uint16_t port
)
55 Ret
= Connection::connect (server
, port
);
57 Ret
= Connection::connect (dns_A (server
), port
);
62 return checkReply (220);
65 int FTP::checkReply (int needle
)
82 if (needle
&& (atoi (S
) != needle
))
92 send ((char *) lpsz_typeI
, strlen (lpsz_typeI
));
93 return checkReply (0);
96 int FTP::login (char * l
, char * p
)
106 m_buf
= CNEW (char, 4096);
108 sprintf (m_buf
, "USER %s\r\n", l
);
109 if (send (m_buf
, strlen (m_buf
)) < 0) {
114 if (checkReply (331) < 0) {
119 sprintf (m_buf
, "PASS %s\r\n", p
);
120 if (send (m_buf
, strlen (m_buf
)) < 0) {
125 if (checkReply (230)) {