MCPcopy Create free account
hub / github.com/Tencent/libco / SetAddr

Function SetAddr

example_echocli.cpp:45–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43};
44
45static void SetAddr(const char *pszIP,const unsigned short shPort,struct sockaddr_in &addr)
46{
47 bzero(&addr,sizeof(addr));
48 addr.sin_family = AF_INET;
49 addr.sin_port = htons(shPort);
50 int nIP = 0;
51 if( !pszIP || '\0' == *pszIP
52 || 0 == strcmp(pszIP,"0") || 0 == strcmp(pszIP,"0.0.0.0")
53 || 0 == strcmp(pszIP,"*")
54 )
55 {
56 nIP = htonl(INADDR_ANY);
57 }
58 else
59 {
60 nIP = inet_addr(pszIP);
61 }
62 addr.sin_addr.s_addr = nIP;
63
64}
65
66static int iSuccCnt = 0;
67static int iFailCnt = 0;

Callers 1

readwrite_routineFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected