there's multiple ways to connect ot SQL; you can see that whenever you look at the SQL configuration manager.
as i understand it, shared memory is always loca, since it's local memory;
named pipes would typically be the next fastest, and is typical for a local connections, but can be foreced to other servers ...I'd actually expect to see Named Pipes on a job or SSMS connection connecting to the same server it's hosted on.
TCP/IP has to go throught he network and n9ic cqard, and might use a dns server to find the target servers before anythimg goes on; network traffic can slow things down(potentially), and it's typically a bit slower.
so the issue you are seeing is "what IP are you using", but sometimes the connection does not use TCP/IP, so the data is null.
i'd just substitute (localhost) when null for reporting/logging purposes.
Lowell