How to close/terminate an existing remote connection using tcp channel.

My problem is while connecting to Remote connection im getting a socket exception saying "No connection could be maid because the target machine actively refused it."

so for the next time i run my application i cannot run the application due to this exception and remote connection does not allow to login.