How to find the client of a UDS connection?
NOTE: for Linux servers only!
SAP uses UDS (UNIX Domain Sockets) communication if both the client and server processes are on the same server, through the "sapstream" files ("/tmp/.sapstreamXXXX").
It might be required to identify the client(s) of an UDS connection.
While logged on as "root", we start by using netstat to identify the "server port" of the UDS connection:
The "server port" is the number to the left of the "sapstream" file.
Then, we use the "ss" command to identify the peers related to that "port". For example, using the "port" number 2279796 (columns' spacing were adjusted for clarity purposes):
Notice that the "ports" can be matched:
- "port" 2279795 is seen at the local address of the BTC work process 10, and at the peer address of the Enqueue process, which is the server of the connection (and creator of the UDS / sapstream3201).
- "port" 2279796 is seen at the peer address of the BTC work process 10, and at the local address of the Enqueue.
- Important: both have "State" as "ESTAB" (established).
The client of the UDS connection:
unix 3 [ ] STREAM CONNECTED 2279796 /tmp/.sapstream3201
is the work process 10.