91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 39KB
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-06-11
  • 語(yǔ)言: C/C++
  • 標(biāo)簽:

資源簡(jiǎn)介

這個(gè)一個(gè)利用TCP協(xié)議,實(shí)現(xiàn)文件傳輸?shù)某绦颍菃尉€程的,并可以顯示傳輸速度。對(duì)學(xué)習(xí)文件傳輸?shù)牧鞒蹋斫釺CP傳輸有很大的幫助。 我學(xué)習(xí)過(guò)了給大家共享一下。

資源截圖

代碼片段和文件信息

??????????????????????????????????
/**
Offload?file?transfer?module?using?socket?to?test?TCP?offload?engine(TOE).
By?Vino?@?9th?June?2004.
Email:?rtc@eyou.com
All?copyrights?reserved.
*/
#include?
#include?
#include?
#include?
#include?
#include?
#ifdef?WIN32
#include?
#include?
#else
#include?
#include?
#include?
#include?
#include?
#endif
#include?

#include?“olfile.h“

const?char?str_usg[]?=?
“\nTransfer?a?file?from?data?source?to?data?sink?through?network.\n\n“
“??olfile?-src?sourcefile?-snk?sinkfile?-ip?dotip?[-y]\n“
“?????Copy?sourcefile?on?local?to?sinkfile?on?ip?dotip.\n\n“
“??olfile?-snk?sinkfile?-src?sourcefile?-ip?dotip?[-y]\n“
“?????Copy?sourcefile?on?ip?dotip?to?sinkfile?on?local.\n\n“
“??olfile?-server\n“
“?????Start?olfile?service.\n\n“
“Options:\n“
“????-src?+?sourcefile??????Data?source?file?full?path\n“
“????-snk?+?sinkfile????????Data?sink?file?full?path\n“
“????-ip??+?dotip???????????Dot?divided?ip?address\n“
“????-y?????????????????????Default?to?delete?exists?file.\n\n“
“Example:\n“
“?????-snk?f:/data.txt?-src?f:/datarcv.txt?-ip?10.190.5.179?-y\n\n“
“By?Vino.Cui?@?9th?June?2004?from?Inventec.\n“
“Revision:\n“
“1.?13th?June?2004?Completed?the?original?version:?Transfering?file?\nfrom?data?source?to?data?sink?via?ip?specified?by?-ip?argument.?\n“;

const?size_t?OP_HEAD_SIZE?=?sizeof(struct?st_op_head);
struct?st_reg_sem?s_reg_sem;
/**?these?4?buffer?pools?are?dynamic?allocated?in?the?program.
??file?->?read-File?Buffer?Pool?->?send-NIC?Buffer?Pool?->?NIC
??file?<-?write-File?Buffer?Pool?<-?receive-NIC?Buffer?Pool?<-?NIC
but?this?implementation?needs?buffer?copy(copy?read-file?Buffer?to?send-NIC?Buffer?pool?and?back-forth).
??char?*rdFileBufPool?*wrFileBufPool;
??char?*sendNicBufPool?*recvNicBufPool;
*/
char?*lanin_buf?*lanout_buf;
char?*gfin_buf?*gfout_buf;
float?ftop_spd?=?0.0;?//?top?speed?bytes/s
/***/

int
init_socket()
{
#ifdef?WIN32
WSADATA?wsaData;
int?iResult?=?WSAStartup(MAKEWORD(22)?&wsaData);
if?(iResult?!=?NO_ERROR)
{
printf(“Error?at?WSAStartup()\n“);
return?-1;
}
return?0;
#else
return?0;
#endif
}

int
create_conn(){
SOCKET?s;
struct?sockaddr_in?local;
BOOL?bOptVal?=?TRUE;
int?bOptLen?=?sizeof(BOOL);
int?iOptLen?=?sizeof(int);

if((s?=?socket(AF_INET_NORMAL?SOCK_STREAM?0))?==?-1){
perror(“socket“);
return?-1;
}

int?a=?setsockopt(s?SOL_SOCKET?SO_REUSEADDR?(char*)&bOptVal?bOptLen);

memset(&(local)?0?sizeof(struct?sockaddr_in));

local.sin_family?=?AF_INET;??????/*?host?byte?order?*/
local.sin_port?=?htons(SERVER_PORT);
local.sin_addr.s_addr?=?INADDR_ANY;
if?(?-1?==?bind(s?(struct?sockaddr*)&local?sizeof(struct?sockaddr))?)
{
fprintf(stderr?“bind?error\n“);
show_err();
return?(-1);
}

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????目錄??????????0??2004-06-25?12:08??client

?????文件??????58368??2004-07-07?13:13??client\olfile.ncb

?????文件???????1270??2004-07-07?13:13??client\olfile.plg

?????文件???????4425??2004-06-13?16:10??client\olfile.dsp

?????文件??????54784??2004-06-17?14:10??client\olfile.opt

?????文件????????535??2004-07-07?13:12??client\olfile.dsw

?????目錄??????????0??2004-06-25?12:07??server

?????文件????????537??2004-06-10?11:42??server\olfiled.dsw

?????文件??????58368??2004-06-17?13:43??server\olfiled.ncb

?????文件???????1300??2004-06-17?13:31??server\olfiled.plg

?????文件???????4436??2004-06-13?16:10??server\olfiled.dsp

?????文件??????54784??2004-06-17?13:43??server\olfiled.opt

?????文件????????727??2004-06-25?11:08??Makefile

?????文件??????31205??2004-07-07?13:14??olfile.cpp

?????文件???????4116??2004-07-07?13:14??olfile.h

?????文件???????1725??2004-07-07?13:31??readme.txt

?????文件???????3189??2004-04-19?10:52??代碼中國(guó).txt

?????文件????????126??2004-04-03?17:45??代碼中國(guó).url

?????文件???????3930??2003-11-05?18:50??說(shuō)明.htm

-----------?---------??----------?-----??----

???????????????283825????????????????????19


評(píng)論

共有 條評(píng)論

相關(guān)資源