提交 7f885cb3 编写于 作者: S Shengliang Guan

TD-1057

上级 8ac389c6
......@@ -91,7 +91,7 @@ int checkTcpPort(info_s *info) {
serverAddr.sin_family = AF_INET;
serverAddr.sin_port = htons(port);
serverAddr.sin_addr.s_addr = taosInetAddr(host);
serverAddr.sin_addr.s_addr = inet_addr(host);
//printf("=================================\n");
if (connect(clientSocket, (struct sockaddr *)&serverAddr, sizeof(serverAddr)) < 0) {
......@@ -157,7 +157,7 @@ int checkUdpPort(info_s *info) {
serverAddr.sin_family = AF_INET;
serverAddr.sin_port = htons(port);
serverAddr.sin_addr.s_addr = taosInetAddr(host);
serverAddr.sin_addr.s_addr = inet_addr(host);
memset(sendbuf, 0, BUFFER_SIZE);
memset(recvbuf, 0, BUFFER_SIZE);
......
......@@ -128,7 +128,7 @@ static void *bindTcpPort(void *sarg) {
if (errno == EINTR) {
continue;
} else {
printf("recv Client: %s pkg from TCP port: %d fail:%s.\n", taosInetNtoa(clientAddr.sin_addr), port, strerror(errno));
printf("recv Client: %s pkg from TCP port: %d fail:%s.\n", inet_ntoa(clientAddr.sin_addr), port, strerror(errno));
close(serverSocket);
return NULL;
}
......@@ -139,7 +139,7 @@ static void *bindTcpPort(void *sarg) {
}
}
printf("recv Client: %s pkg from TCP port: %d, pkg len: %d\n", taosInetNtoa(clientAddr.sin_addr), port, iDataNum);
printf("recv Client: %s pkg from TCP port: %d, pkg len: %d\n", inet_ntoa(clientAddr.sin_addr), port, iDataNum);
if (iDataNum > 0) {
send(client, buffer, iDataNum, 0);
break;
......@@ -188,7 +188,7 @@ static void *bindUdpPort(void *sarg) {
continue;
}
if (iDataNum > 0) {
printf("recv Client: %s pkg from UDP port: %d, pkg len: %d\n", taosInetNtoa(clientAddr.sin_addr), port, iDataNum);
printf("recv Client: %s pkg from UDP port: %d, pkg len: %d\n", inet_ntoa(clientAddr.sin_addr), port, iDataNum);
//printf("Read msg from udp:%s ... %s\n", buffer, buffer+iDataNum-16);
sendto(serverSocket, buffer, iDataNum, 0, (struct sockaddr *)&clientAddr, (int)sin_size);
......
......@@ -67,7 +67,7 @@ int taosSetSockOpt(SOCKET socketfd, int level, int optname, void *optval, int op
// TAOS_OS_FUNC_SOCKET_INET
uint32_t taosInetAddr(char *ipAddr);
const char *taosInetNtoa(IN_ADDR ipInt);
const char *taosInetNtoa(struct in_addr ipInt);
#ifdef __cplusplus
}
......
......@@ -65,7 +65,7 @@ uint32_t taosInetAddr(char *ipAddr) {
return inet_addr(ipAddr);
}
const char *taosInetNtoa(IN_ADDR ipInt) {
const char *taosInetNtoa(struct in_addr ipInt) {
return inet_ntoa(ipInt);
}
......
......@@ -76,7 +76,7 @@ uint32_t taosInetAddr(char *ipAddr) {
}
}
const char *taosInetNtoa(IN_ADDR ipInt) {
const char *taosInetNtoa(struct in_addr ipInt) {
// not thread safe, only for debug usage while print log
static char tmpDstStr[16];
return inet_ntop(AF_INET, &ipInt, tmpDstStr, INET6_ADDRSTRLEN);
......
......@@ -323,7 +323,7 @@ static void *httpAcceptHttpConnection(void *arg) {
}
pContext->pThread = pThread;
sprintf(pContext->ipstr, "%s:%u", taosInetAddr(clientAddr.sin_addr), htons(clientAddr.sin_port));
sprintf(pContext->ipstr, "%s:%u", taosInetNtoa(clientAddr.sin_addr), htons(clientAddr.sin_port));
struct epoll_event event;
event.events = EPOLLIN | EPOLLPRI | EPOLLWAKEUP | EPOLLERR | EPOLLHUP | EPOLLRDHUP;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册