Skip to content

Commit

Permalink
Print remote port.
Browse files Browse the repository at this point in the history
  • Loading branch information
zruibin committed Jul 27, 2024
1 parent f2600de commit a717987
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/socket/udp_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class UDPSocket

if (strncmp(data_, "ip", 2) == 0) {
std::string address = sender_endpoint_.address().to_string();
Log(INFO) << "Remote Address: " << address;
Log(INFO) << "Remote Address: " << address
<< ", Port: " << sender_endpoint_.port();
strcpy(data_, address.c_str());
length = address.length();
}
Expand Down Expand Up @@ -96,6 +97,8 @@ void runAsynUDPSocket(short port)
/*
测试命令: nc -u 127.0.0.1 5566
查询指定端口号进程信息: lsof -i:端口号
python测试脚本:
# -*- coding: utf-8 -*-
Expand Down

0 comments on commit a717987

Please sign in to comment.