WiFi shield-How can I see when the communication goes down?

Hi, I have a wifi shield with the WiFly RN-171 chip (seeedstudio.com/wiki/Wifi_Shield). It is connected to a Arduino Uno board.
Communication with the TCP server (I’m using YFTPServer to test it) works perfectly (sketch here: seeedstudio.com/wiki/images/ … Shield.zip).
BUT, if I stop the server communication (server side) and the I restart it, the WiFi shield doesn’t restart.

My question is:
how can I detect (arduino side) when the communication closes?
I studied the library but I didn’t find any solution.

Can anybody help me?

Thanks a lot