at what stage does the connection go down? i mean.. you do close the socket so it should go down at the end of your code...