I'm trying to find a way to closing a network connection that has been established by another process. My application will run over night automatically. In case the network resource is already in use (which it shouldn't be, but I'm not assuming) I need to close the connection before establishing it with the correct credentials. Again, not assuming the existing connection has the correct access.
Using GetTcpTable() I can search the existing connections for an IP. Now I need to close it. I can find lots of info about closing a connection based on its socket, but I don't know the socket. Can I find out which sockets are used by a given connection (based on remote IP?) or is there some other method of closing a network connection based on remote IP?