关于unix domain的trick

Here are the tricks :

use socat to catch unix socket(need to restart clients that connected to the socket)
1,download socat:
wget http://192.168.0.254/misc/asi22/sandy//socat/socat-1.7.4.3/imx6/bin/socat
wget http://192.168.0.254/misc/asi22/sandy//socat/libreadline.so.6

2,establish a proxy that can catch data by wireshark from lo
here are the commands:(sudo first)
mv /tmp/PCMGR_UI /tmp/PCMGR_UI.original
./socat TCP-LISTEN:8089,reuseaddr,fork UNIX-CONNECT:/tmp/PCMGR_UI.original
./socat UNIX-LISTEN:/tmp/PCMGR_UI,fork TCP-CONNECT:127.0.0.1:8089

3,start catch logs(directly output)
./tcpdump -i lo -netvv port 8089

tips:netstat can only display server PID, so need to check which client needs be restart.

 

refer:

通过tcpdump对Unix Domain Socket 进行抓包解析 | plantegg

Unix Domain Socket – coding & life (kirk91.github.io)

 

mv /tmp/PCMGR_UI /tmp/PCMGR_UI.original这一步操作,实际上是将sock文件移动,从而可以新建一个同名的sock文件供Client使用,实际上Server端仍然在监听该Innode。