Hi,
I am using Domain object in System.DirectoryServices.ActiveDirectory namespace. When ever I query domain details using Domain.GetCurrentDomain or Domain.GetDomain, it establishes connection with domain controller. This connection can be seen with "netstat -ano|findstr 389" command.
Code:
Domain dom = Domain.GetCurrentDomain();
My question is, how to close the connection ? The only way I can close the connection is to dispose the Domain object. Since I have cached the Domain object in my code I don't want dispose it. The problem it raises is, 'ESTABLISHED' state remains for some time later it changes to 'CLOSE_WAIT'.
netstat -ano | findstr 389
TCP 10.241.93.168:51291 154.1.124.156:389 CLOSE_WAIT 8028
TCP 10.241.93.168:51297 154.1.124.154:389 CLOSE_WAIT 8028
TCP 10.241.93.168:51302 154.1.124.158:389 CLOSE_WAIT 8028
TCP 10.241.93.168:51320 154.1.124.155:389 CLOSE_WAIT 8028
TCP 10.241.93.168:51323 154.1.124.153:389 CLOSE_WAIT 8028
TCP 10.241.93.168:51332 154.1.124.157:389 CLOSE_WAIT 8028
TCP 10.241.93.168:53399 148.86.153.162:389 CLOSE_WAIT 8028
TCP 10.241.93.168:53436 139.172.150.15:389 CLOSE_WAIT 8028
For security reason I need to eliminate this stale connection. Do let me know if you have any suggestions.
Thanks,Santhosh