电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

FTP客户端和服务器源代码(C语言)实现

FTP客户端和服务器源代码(C语言)实现_第1页
1/26
FTP客户端和服务器源代码(C语言)实现_第2页
2/26
FTP客户端和服务器源代码(C语言)实现_第3页
3/26
课程设计:FTP 的设计与实现 /****************client.c****************/ #include #include #include #pragma comment(lib,"ws2_32.lib") #define DEFAULT_PORT 2302 #define DEFAULT_BUFFER 2048 #define DEFAULT_MESSAGE "This is a test of the emergency \ broadcasting system" char szServerip[128], // Server to connect to szMessage[1024]; // Message to send to sever int iPort = DEFAULT_PORT; // Port on server to connect to //DWORD dwCount = DEFAULT_COUNT; // Number of times to send message BOOL bSendOnly = FALSE; // Send data only; don't receive int dirfun(); int getfun(); int putfun(); int pwdfun(); int cdfun(); int mdfun(); int delfun(); int usafun(); void usage() { printf("usage: client [-p:x] [-s:IP] [-n:x] [-o]\n\n"); printf(" -p:x Remote port to send to\n"); printf(" -s:IP Server's IP address or hostname\n"); printf(" -n:x Number of times to send message\n"); printf(" -o Send messages only; don't receive\n"); ExitProcess(1); } void ValidateArgs(int argc, char **argv) { int i; for(i = 1; i < argc; i++) { if ((argv[i][0] == '-') || (argv[i][0] == '/')) { switch (tolower(argv[i][1])) { case 'p': // Remote port if (strlen(argv[i]) > 3) iPort = atoi(&argv[i][3]); break; case 's': // Server if (strlen(argv[i]) > 3) strcpy(szServerip, &argv[i][3]); break; case 'n': // Number of times to send message if (strlen(argv[i]) > 3) //dwCount = atol(&argv[i][3]); break; case 'o': // Only send message; don't receive bSendOnly = TRUE; break; default: usage(); break; } } } } int main(int argc, char **argv) { WSADATA wsd; SOCKET sClient; char szBuffer[DEFAULT_BUFFER]; int ret; //unsigned int i; //int j; struct sockaddr_in server; struct hostent *host = NULL; char choice[5],choice2[40]; // Parse the command li...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

FTP客户端和服务器源代码(C语言)实现

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部