-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
87 lines (75 loc) · 1.58 KB
/
main.cpp
File metadata and controls
87 lines (75 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// main.cpp
// Program5
//
// Created by Artem Kovtunenko on 3/2/16.
// Copyright (c) 2016 432. All rights reserved.
//
#include <string>
#include <iostream>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <netinet/tcp.h>
#include <sys/uio.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include "Socket.h"
#include "FTPClient.h"
using namespace std;
int main(int argc, const char * argv[])
{
FTPClient ftp(argv[1]);
ftp.userName();
ftp.passwd();
while(true)
{
cout << "ftp> ";
string command;
cin >> command;
if(command == "syst")
{
ftp.setCommandRequest("syst");
ftp.syst();
}
if(command == "ls")
{
ftp.setCommandRequest("ls");
ftp.lsCMD();
}
if(command == "cd")
{
ftp.setCommandRequest("cd");
ftp.cdCMD();
}
if(command == "close")
{
ftp.setCommandRequest("close");
ftp.closeConnection();
//break;
}
if(command == "quit")
{
ftp.setCommandRequest("quit");
ftp.quitCMD();
break;
}
if(command == "get")
{
ftp.setCommandRequest("get");
ftp.getCMD();
}
if(command == "put")
{
ftp.setCommandRequest("put");
ftp.putCDM();
}
}
return 0;
}