Skip to content

854825967/mylib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I create a net lib named Super Net worker, Interface

src\libnet\Interface\INet.h
First u must set callback address...
//callback when connect host succeed
virtual bool CSetConnectedCall(const CALL_FUN pcntedfun) = 0;
//callback when connected failed
virtual bool CSetConnectFailedCall(const CALL_FUN pcntfailedfun) = 0;
//callback when break
virtual bool CSetConnectionBreakCall(const CALL_FUN pbreakfun) = 0;
//callback when recv msg
virtual bool CSetRecvCall(const CALL_FUN precvfun) = 0;
//callback when a new remoter connected
virtual bool CSetNewConCall(const CALL_FUN precvfun) = 0;

Use this interface start net event
//async listen
virtual bool CListen(const char * ip, const u16 port, const u16 count = 200) = 0;
//async connect
virtual bool CConnectEx(const char * ip, const u16 port, const void * buff = NULL, const u32 size = 0) = 0;
//close link
virtual bool CClose(const u16 conid) = 0;
//async send msg
virtual bool CSendMsg(const u16 conid, const void * buff, const u16 size) = 0;
//get remote info
virtual bool CGetRemoteInfo(const u16 conid, const char * & ip, u16 & port) = 0;
//start network thread
virtual void CStartLoop(u32 waitTime = 5, bool demon = false) = 0;

Contact Me

About

liblog,libnet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages