Breep开源项目

我要开发同款
匿名用户2021年11月30日
81阅读

技术信息

开源地址
https://github.com/apple/GCGC
授权协议
EUPL-1.1 License

作品详情

BreepWhatisBreep?

Breepisac++bridgedpeertopeerlibrary.Whatdoesthatmea?Itmeasthatevethoughtheetworkiscostructedasapeertopeeroe,theremaybeodirectcoectiosbetweetwodudes,sayAadB,ifthesecoectiosareimpossible(duetopoorlycofiguredports,forexample).Ithatcase,BreepwillattempttouseaotherpeerCasabridgebetweeAadB.Breepisalsoahigh-levellibrary.Youdo'thavetocareowhepeerscoect,discoect,seddata,adohowtosedyourclasses.Yousimplyregisterlisteersthatgetotifiedwhepeerscomeadgo,whetheysedyoustuff.Youmayeveuseserializatioadsedyourowobjectdirectlythroughtheetwork.Samegoesforyourlisteers:youdo'tsay'Iwattolisteforpilesofbytes',butisteadyousay'Iwattolisteforfacy::MyClass'.

HowdoIuseBreep::etwork?

Thebestwaytoowitistoreadthetutorials.Alteratively,youmayreadsomeexamplesadtheoliedoc.Butasalittlepreview,hereisa'HelloWorld!'-typeexample:

Hereishowtocreateaetwork,startlisteigoport1234,adsed"Hello!"toaybudythatcoects:

BREEP_DECLARE_TYPE(std::strig)voidco_listeer(breep::tcp::etwork&etwork,costbreep::tcp::peer&source){etwork.sed_object_to(source,std::strig("Hello!"));}itmai(){breep::tcp::etworketwork(1234);etwork.add_coectio_listeer(&co_listeer);etwork.syc_awake();retur0;}

TheBREEP_DECLARE_TYPEivolvedhereisusedtotelltobreep::etworkthatwewillliste/sedsomestd::strigs.Ifyouforgettodoit,youwillgetacompile-timeerror.

Thereishowtodotheopposite:theetworkstartslisteigoport1233,triestocoectatlocalhost:1234,pritsthefirstmessageitsees,thediscoect:

BREEP_DECLARE_TYPE(std::strig)voiddata_listeer(breep::tcp::etdata_wrapper<std::strig>&dw){std::cout<<dw.data<<std::edl;dw.etwork.discoect();}itmai(){breep::tcp::etworketwork(1233);etwork.add_data_listeer<std::strig>(&data_listeer);if(!etwork.coect(boost::asio::ip::address_v4::loopback(),1234)){std::cout<<"Failedtocoect.\";retur1;}etwork.joi();retur0;}

Pleasedo'tgetcofused:thereisoUDPithislib(yet).

WhyshouldIuseBreep::etwork?It'sawesome!It'shighlevel:youcadirectlysedadreceiveobjects.Theoverheadforthisislow:ifyousetupwellyourserializatio,youolyhaveafixed64bitsextraoverhead(comparedtosedigrawbytestothep2petwork—icompariso,TCPhas320bitsofoverheadolyforitsheader)It'seasytogeti:justreadtheexamples,you'llsee!WhyshouldINOTuseBreep::etwork?Ithasotbeetestedasmuchasitshouldhavebee.It'sprobablybrokeforBigEdiaarchitecture(Ihaveowaytotestthis,sorry;awarigshouldbedisplayedosucharchitectures.)It'svery,veryslowtocompilewith.RequiremetsResourceRequiremetCompilerC++14compliatoraboveBoostBoost1.55oraboveRoadMapMilestoeFeatureStatus0.1Peertopeeretworkmaagemetcomplete0.1Istatiatedobjectsdeliverycomplete1.0Improvedserializatiocomplete1.0Multipleobjectsdeliveryioegocompletex.xClietserveretworkmaagemetohold

TheprojectiscurretlyotestigstagebeforethereleaseofBreep1.0.0

Licese

ThisworkisudertheEuropeaUioPublicLicesev1.1.

YoumaygetacopyofthisliceseiyourlaguagefromtheEuropeaCommissiohere.

Extractofarticle13:

AllliguisticversiosofthisLicece,approvedbytheEuropeaCommissio,haveideticalvalue.Partiescatakeadvatageoftheliguisticversiooftheirchoice.Author

LucasLazare,aITstudetfrustratedfromotbeigabletoproperlyusejava'sbrokeetworklibrary,adispiredbyKryoNet

功能介绍

Breep What is Breep? Breep is a c++ bridged peer to peer library. What does that mean? It means t...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论