You have to use the SetTcpEntry to close the port.

GetTcpTable:
http://msdn2.microsoft.com/en-us/library/aa366026.aspx

SetTcpEntry:
http://msdn2.microsoft.com/en-us/library/aa366378.aspx


If you use the structure's data you can set the state of the port to closed (MIB_TCP_STATE_CLOSED).
http://msdn2.microsoft.com/en-us/lib...09(VS.85).aspx