freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

文件傳輸協(xié)議的c語言實(shí)現(xiàn)-在線瀏覽

2025-07-17 22:04本頁面
  

【正文】 t sputfun(SOCKET h_NewSocket)。int scdfun(SOCKET h_NewSocket)。int sdelfun(SOCKET h_NewSocket)。 SOCKET h_Socket4Lstn。//地址長度 //初始化winsock if (WSAStartup(MAKEWORD(2,2), amp。 printf(WSAStartup failed\n)。SLocalAddr,0,sizeof(SLocalAddr))。 if (h_Socket4Lstn 0) printf(creating socket failed\n)。 if(argc == 2) = htons((u_short)atoi(argv[1]))。 = INADDR_ANY。SLocalAddr),sizeof(SLocalAddr)) 0) printf(Bind failed!\n)。 //啟動監(jiān)聽 addr_in_len = sizeof(RemoteAddr)。RemoteAddr) , amp。 if (h_NewSocket == INVALID_SOCKET) break。 sprintf(SendBuffer,200 Wele \r\n)。 sprintf(SendBuffer,530 Log in \r\n)。 while (1) { //接收客戶端的命令并調(diào)用命令處理函數(shù) n = 0。 while (1) { bytes = recv(h_NewSocket, amp。 if ((bytes 0) || (bytes == 0)) break。$39。\039。 } if (RecvBuffer[n] != 39。) n++。 printf(The Server received: 39。 cmd from client \n, RecvBuffer)。 //查詢當(dāng)前目錄路徑 if(strncmp(RecvBuffer,pwd,3)==0) spwdfun(h_NewSocket)。 //文件下載 if (strncmp(RecvBuffer,get,3)==0) sgetfun(h_NewSocket)。 //新建文件夾 if (strncmp(RecvBuffer,md,2)==0) smdfun(h_NewSocket)。 if (strncmp(RecvBuffer,quit,4)==0) //退出命令 { printf(quit \n)。 bytes = send(h_NewSocket, SendBuffer, strlen(SendBuffer), 0)。 break。 sprintf(SendBuffer, 500 Syntax error. \n)。 } } closesocket(h_NewSocket)。 } closesocket(h_Socket4Lstn)。}/***********************************************************************函數(shù)名:sdirfun說明: 用于處理來自客戶端的目錄查詢命令輸入?yún)?shù): SOCKET h_NewSocket,命令通過此socket接收到,可通過它響應(yīng)命令。 FILE *p_FiLeTemp。\039。 strcat(strObject,path)。 system(strObject)。 //打開執(zhí)行結(jié)果文件,準(zhǔn)備發(fā)送到客戶端 sprintf(SendBuffer, 125 Transfering... \r\n)。 while (fgets(temp_buffer,80,p_FiLeTemp)!=NULL) //每次讀取80字節(jié)發(fā)送 { sprintf(SendBuffer,%s,temp_buffer)。 } fclose(p_FiLeTemp)。 bytes = send(h_NewSocket, SendBuffer, strlen(SendBuffer), 0)。 //刪除結(jié)果臨時文件 sprintf(SendBuffer,226 Close the data socket... \r\n)。 printf(dir mand has been done! \n)。 return 0。***********************************************************************/int sgetfun(SOCKET h_NewSocket){ int i=4,k=0。char *p_FileName=strObject。 printf(required file is: )。RecvBuffer[i], 1, 0)。 if ((bytes 0) || (bytes == 0)) break。 if (RecvBuffer[i] == 39。) { FileName[k] = 39。 break。\r39。 k++。 //文件名打印結(jié)束 strObject[0]=39。 strcat(strObject,path)。 strcat(strObject,FileName)。 bytes = send(h_NewSocket, SendBuffer, strlen(SendBuffer), 0)。 bytes = send(h_NewSocket, SendBuffer, strlen(SendBuffer), 0)。 } else { printf(The file %s is found,ready to transfer.\n,FileName)。 bytes = send(h_NewSocket, SendBuffer, strlen(SendBuffer), 0)。 send(h_NewSocket, SendBuffer, 80, 0)。 //文件發(fā)送中,每發(fā)80個字節(jié)在屏幕打一個點(diǎn)號 } fclose(fp)。 bytes = send(h_NewSocket, SendBuffer, strlen(SendBuffer), 0)。 printf(get mand has been done! \n)。}/***********************************************************************函數(shù)名:sputfun說明: 用于處理來自客戶端的文件上傳命令***********************************************************************/int sputfun(SOCKET h_NewSocket){ Printf(“篇幅所限,請讀者完成。 return 0。\n”); iSynError=0。}/***********************************************************************函數(shù)名:scdfun說明: 用于處理來自客戶端的當(dāng)前路徑設(shè)置命令***********************************************************************/int scdfun(SOCKET h_NewSocket){ Printf(“篇幅所限,請讀者完成。 return 0。\n”); iSynError=0。}/***********************************************************************函數(shù)名:sdelfun說明: 用于處理來自客戶端的文件刪除命令***********************************************************************/int sdelfun(SOCKET h_NewSocket){ Printf(“篇幅所限,請讀者完成。 return 0。**********************************************************************/include include include pragma ment(lib,)define DEFAULT_SERV_PORT 2416 //服務(wù)器的監(jiān)聽端口define DEFAULT_BUFFER_SIZE 2048 //緩沖區(qū)長度char sz_ServIp[128]。 // 發(fā)給服務(wù)器端的字符串int iPort = DEFAULT_SERV_PORT。 // 只發(fā)消息,不收消息int dirfun(SOCKET )。 //get命令處理函數(shù)int putfun(SOCKET h_Socket4Cmd,char FileName[40])。
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1