我有一个开源示例,它正在工作,但我无法理解 TCP/UDP 连接发生在哪里?HHNET_LogonServer
测试.c:
#include "HHNet.h"
#include "HHDecoder.h"
#include "stdio.h"
#include <unistd.h>
#include <pthread.h>
#include <netinet/in.h>
...
int main(int argc, char **argv) {
HHERR_CODE errCode;
unsigned long dwTmp;
unsigned int nPort;
errCode = HHERR_FAILURE;
if (argc < 4) {
printf("Usage:<./SDKDemo> <IP> <Username> <Password> <Data port>\n");
exit(0);
} else {
dwTmp = strlen(*(argv + 1));
if ( (dwTmp > 7) && (dwTmp < 15 )) {
g_pIPString = (*(argv + 1));
} else {
printf("Invalid IP !\n");
}
g_pUseName = argv[2];
g_pPASSWD = argv[3];
if ((nPort = atoi(argv[4])) > 0) {
g_lPort = nPort;
}
}
errCode = HHNET_Startup(5000, LogonNotifyCallback, CheckUserPswCallback, UpdateFileCallback, ServerMsgCmdCallback, StreamWriteCheckCallback, (ChannelStreamCallback)PreviewStreamCallback);
printf(">HHNET_Startup: %s\n", errCode?"Failed!":"Successful!");
HANDLE m_hLogonServer;
errCode = HHNET_LogonServer(g_pIPString, g_lPort, "admin", g_pUseName, g_pPASSWD, 0, &m_hLogonServer);
printf(">HHNET_LogonServer: %s\n",errCode?"Failed!":"Successful!");
errCode = HHNET_LogoffServer(m_hLogonServer);
if (errCode) {
printf("Error code:%d\n", errCode);
printf(">HHNET_LogoffServer: Failed!\n");
} else {
printf(">HHNET_LogoffServer: Successful!\n");
}
HHNET_Cleanup();
return 0;
}
HHNet.h:(https://gist.github.com/3067481)
HHERR_CODE HHNET_LogonServer(IN CHAR *pServerIP,IN UINT nServerPort,IN CHAR *pDeviceName,IN CHAR *pUserName,IN CHAR *pUserPassword,IN UINT dwClientID,OUT HANDLE *hLogonServer);
HHDecoder.h:(https://gist.github.com/3067481)
输出:
$ ./test 192.168.0.199 admin admin 5000
sh: /proc/sys/net/ipv4/tcp_keepalive_time: Permission denied
sh: /proc/sys/net/ipv4/tcp_keepalive_intvl: Permission denied
sh: /proc/sys/net/ipv4/tcp_keepalive_probes: Permission denied
>HHNET_Startup: Successful!
--->| HHNET_LogonServer :192.168.0.199
>HHNET_LogonServer: Successful!
>HHNET_LogoffServer: Successful!
但我不知道这个触发器发生在哪里--->| HHNET_LogonServer :192.168.0.199