资源简介
互联网应用课程的大作业,rar压缩包无密码,解压后的资源包括:源代码+pdf的报告,其中源代码为一个程序,pdf报告中包含程序教程、截图、及设计流程图。
代码片段和文件信息
/* header files */
// ƒ‹ µœ÷get put £¨“˛≤ÿ√‹¬Î∫√¡À‘›«“’‚—˘œ‘ æ∫Ï…´£¨mayan≤ª–– 6.3 20:00
#include
#include
#include
#include
#include /* getservbyname() gethostbyname() */
#include /* for definition of errno */
#include /* for inet_aton()*/ // ...................
#include /* for inet_aton()*/ // ...................
#include /* for inet_aton()*/ // ...................
#include
#include /* for write open read */
#include /* for read write open */
#include
#include /*for mask password*/
#define BACKLOG 10 /* ◊Ó¥ÛÕ¨ ±¡¨Ω”«Î«Û ˝ */
/* define macros*/
#define MAXBUF 1024
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define ECHOFLAGS (ECHO | ECHOE | ECHOK | ECHONL) // /*for mask password*/
/* define FTP reply code */
#define USERNAME 220
#define PASSWORD 331
#define LOGIN 230
#define PATHNAME 257
#define CLOSEDATA 226
#define ACTIONOK 250
/* DefinE global variables */
char *host; /* hostname or dotted-decimal string */
char *port;
char *rbuf *rbuf1; /* pointer that is malloc‘ed */
char *wbuf *wbuf1; /* pointer that is malloc‘ed */
struct sockaddr_in servaddr;
struct hostent *hptr;
struct in_addr temporary_IP;
int totalfilesize;
int upfilesize;
struct timeval startstartup;
struct timeval endendup;
long timeusedtimeusedup;
int retransmit=0;
char *thesize;
char *limitspeed;
int fileno(FILE *stream);
int fstat(int filedesstruct stat *buf);
struct stat thefilestruct;
struct stat upfilestruct;
int cliopen(char *host char *port); /* function list */
void strtosrv(char *str char *host char *port);
void cmd_tcp(int sockfd);
void ftp_list(int sockfd);
int ftp_get(int sck char *pDownloadFileName_s);
int ftp_put (int sck char *pUploadFileName_s);
int flag_150=0; // to distinguish “ls“ and “ get [filename]“ instuction
int
main(int argc char *argv[])
{
int fd;
//code here: Allocate the read and write buffers before open().
char write_buffer[MAXBUF]; // send to server
char read_buffer[MAXBUF]; // get from server
if (0 != argc-2)
{
printf(“%s\n““missing “);
exit(0);
} // end of if
host = argv[1];
port = “21“;
rbuf=(char *)malloc(MAXBUF);
rbuf1=(char *)malloc(MAXBUF);
wbuf=(char *)malloc(MAXBUF);
wbuf1=(char *)malloc(MAXBUF);
fd = cliopen(host port);
printf(“sockfd(the first) is %d \n“fd);
cmd_tcp(fd);
exit(0);
} // end of main function
/* Establish a TCP connection from client to server */
int cliopen(char *host char *port)
{
int a; // host is IP or domain name
int sockfd;// returned socket number
int send_length;
int receive_length;
char str[32];
unsigned short echoServPort;
char *servIP;
// host is IP or domain name
a=inet_aton(host&temporary_IP);
printf(“flag is : %d (1 means IP0
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1216362 2013-06-17 19:23 ftpclt_2010215102_10212784&10212772_梁扬&王可惟.pdf
文件 30658 2013-06-12 12:56 ftpclt_2010215102_10212784&10212772_梁扬&王可惟.c
----------- --------- ---------- ----- ----
1247020 2
相关资源
- warftp1.65
- CuteFTP Pro 8.3 中文绿色注册版最好用的
- 新版dnw支持win10驱动及软件
- vim离线安装包。
- 博创2410开发板—LINUX实验指导书
- node_exporter-0.18.1.linux-amd64.tar.gz
- EtherCat主站代码Linux下
- linux运维笔记
- Linux_C编程一站式学习_最新版.pdf
- Linux网络编程+RouterOS_3.0中文教程+Rou
- SSHSecureShellClient-3.2.9 64位安装包
- gcc-2.8.1.tar.bz2
- Linuxcentos下的Apache安装压缩包:httpd
- rtl8188eu_USB_linux.tar.gz
- 操作系统设计与实现PDF
- hdf5 Linux下的安装包 以及make文件
- Linux内核源代码情景分析(上下全册高
- Realtek瑞昱 rtl8188cus linux驱动
- 软件调试的艺术
- MahjongClient.zip
- DCOM自动配置及OPCClient相关文件
- Ubuntu Linux 指南
- 一个通用的线程池实现代码(Windows
- linux下串口监控的方法和工具
- Linux基于Live555获取rstp实时264视频流并
- yocto 超详细教程,看完必会搭建linu
- 使用HttpURLConnection或HttpClient方式传j
- 25000Linux集群完整版去后门生成器.ra
- 鸟哥的Linux私房菜基础学习篇第四版
- Linux系统下的数码相框
评论
共有 条评论