NetConnectionEnum or Net32ConnectionEnum

The NetConnectionEnum API lists (1) the connections made to a shared resource of a server or (2) all connections established from a particular computer to a server.