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

  • 大小: 393KB
    文件類(lèi)型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-10
  • 語(yǔ)言: C/C++
  • 標(biāo)簽:

資源簡(jiǎn)介

UDP實(shí)現(xiàn)的可靠文件傳輸?shù)腣C++源代碼,經(jīng)典作品,物美價(jià)廉,值得收藏,是程序員的必備法寶.

資源截圖

代碼片段和文件信息

#ifndef?WIN32
???#include?
???#include?
???#include?
???#include?
#else
???#include?
???#include?
#endif
#include?
#include?
#include?“cc.h“

using?namespace?std;

#ifndef?WIN32
void*?monitor(void*);
#else
DWORD?WINAPI?monitor(LPVOID);
#endif

int?main(int?argc?char*?argv[])
{
???if?((3?!=?argc)?||?(0?==?atoi(argv[2])))
???{
??????cout?<??????return?0;
???}

???struct?addrinfo?hints?*local?*peer;

???memset(&hints?0?sizeof(struct?addrinfo));

???hints.ai_flags?=?AI_PASSIVE;
???hints.ai_family?=?AF_INET;
???hints.ai_socktype?=?SOCK_STREAM;
???//hints.ai_socktype?=?SOCK_DGRAM;

???if?(0?!=?getaddrinfo(NULL?“9000“?&hints?&local))
???{
??????cout?<??????return?0;
???}

???UDTSOCKET?client?=?UDT::socket(local->ai_family?local->ai_socktype?local->ai_protocol);

???//?UDT?Options
???//UDT::setsockopt(client?0?UDT_CC?new?CCCFactory?sizeof(CCCFactory));
???//UDT::setsockopt(client?0?UDT_MSS?new?int(9000)?sizeof(int));
???//UDT::setsockopt(client?0?UDT_SNDBUF?new?int(10000000)?sizeof(int));
???//UDT::setsockopt(client?0?UDP_SNDBUF?new?int(10000000)?sizeof(int));

???#ifdef?WIN32
??????UDT::setsockopt(client?0?UDT_MSS?new?int(1052)?sizeof(int));
???#endif

???//?for?rendezvous?connection?enable?the?code?below
???/*
???UDT::setsockopt(client?0?UDT_RENDEZVOUS?new?bool(true)?sizeof(bool));
???if?(UDT::ERROR?==?UDT::bind(client?local->ai_addr?local->ai_addrlen))
???{
??????cout?<??????return?0;
???}
???*/

???freeaddrinfo(local);

???if?(0?!=?getaddrinfo(argv[1]?argv[2]?&hints?&peer))
???{
??????cout?<??????return?0;
???}

???//?connect?to?the?server?implict?bind
???if?(UDT::ERROR?==?UDT::connect(client?peer->ai_addr?peer->ai_addrlen))
???{
??????cout?<??????return?0;
???}

???freeaddrinfo(peer);

???//?using?CC?method
???//CUDPBlast*?cchandle?=?NULL;
???//int?temp;
???//UDT::getsockopt(client?0?UDT_CC?&cchandle?&temp);
???//if?(NULL?!=?cchandle)
???//???cchandle->setRate(500);

???int?size?=?100000;
???char*?data?=?new?char[size];

???#ifndef?WIN32
??????pthread_create(new?pthread_t?NULL?monitor?&client);
???#else
??????CreateThread(NULL?0?monitor?&client?0?NULL);
???#endif

???for?(int?i?=?0;?i????{
??????int?ssize?=?0;
??????int?ss;
??????while?(ssize???????{
?????????if?(UDT::ERROR?==?(ss?=?UDT::send(client?data?+?ssize?size?-?ssize?0)))
?????????{
????????????cout?<????????????break;
?????????}

?????????ssize?+=?ss;
??????}

??????if?(ssize??????????break;
???}

???UDT::close(client);

???delete?[]?data;

???return?1;
}


?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????目錄???????????0??2008-03-18?20:33??udt4\app\
?????文件????????3828??2007-11-18?17:23??udt4\app\appclient.cpp
?????文件???????23552??2008-03-18?20:32??udt4\app\appclient.exe
?????文件????????3433??2007-11-06?16:32??udt4\app\appserver.cpp
?????文件???????23552??2008-03-18?20:32??udt4\app\appserver.exe
?????文件????????2334??2008-03-18?20:32??udt4\app\BuildLog.htm
?????文件????????1685??2007-08-28?17:23??udt4\app\cc.h
?????文件????????2014??2007-09-08?00:30??udt4\app\recvfile.cpp
?????文件???????19456??2008-03-18?20:32??udt4\app\recvfile.exe
?????文件????????2529??2007-09-08?01:02??udt4\app\sendfile.cpp
?????文件???????19968??2008-03-18?20:32??udt4\app\sendfile.exe
?????文件??????172032??2008-03-18?20:24??udt4\app\udt.dll
?????目錄???????????0??2008-03-18?20:10??udt4\doc\
?????目錄???????????0??2008-03-18?20:10??udt4\doc\doc\
?????文件????????3298??2007-06-08?13:43??udt4\doc\doc\accept.htm
?????文件????????3157??2007-06-25?21:56??udt4\doc\doc\bind.htm
?????文件????????5865??2007-07-15?21:31??udt4\doc\doc\ccc.htm
?????文件????????2686??2007-10-02?17:32??udt4\doc\doc\close.htm
?????文件????????4215??2007-10-02?17:31??udt4\doc\doc\connect.htm
?????文件????????2168??2007-10-25?21:43??udt4\doc\doc\copy.htm
?????文件????????4782??2007-09-20?22:58??udt4\doc\doc\ecode.htm
?????文件????????1467??2007-07-15?21:41??udt4\doc\doc\error.htm
?????文件????????9881??2007-12-02?19:37??udt4\doc\doc\faq.htm
?????文件?????????563??2007-12-31?23:56??udt4\doc\doc\footer.htm
?????文件????????3134??2007-06-05?10:33??udt4\doc\doc\function.htm
?????文件?????????331??2007-06-05?10:33??udt4\doc\doc\header.htm
?????文件????????1893??2007-09-06?20:13??udt4\doc\doc\intro.htm
?????文件????????2583??2007-06-08?13:51??udt4\doc\doc\listen.htm
?????文件????????2721??2007-07-15?11:34??udt4\doc\doc\make.htm
?????文件????????6907??2007-06-25?21:56??udt4\doc\doc\opt.htm
?????文件????????2640??2007-06-08?13:55??udt4\doc\doc\peername.htm
............此處省略84個(gè)文件信息

評(píng)論

共有 條評(píng)論

相關(guān)資源