Computer going on sleep while app retrieving blob


My app makes a query on a remote mysql server and retrieves blob fields of 20Mb. When the computer goes on sleep while a query is going on, and then wakes again, the app that did this query is hanging and nothing works.

What is a good approach to handle this problem?