{
/**
+ * The printer-poll timeout.
+ */
+ private static final int timeout = 1000;
+
+ /**
* Helper class used to write the attributes of a request
* into the supplied data output stream in the correct way.
*
alreadySent = true;
- OutputStream stream = stream = connection.getOutputStream();
+ OutputStream stream = connection.getOutputStream();
DataOutputStream out = new DataOutputStream(stream);
// the header 8 bytes long
out.flush();
stream.flush();
-
- int responseCode = responseCode = connection.getResponseCode();
+
+ // Set the connection timeout, for if the printer is offline.
+ // FIXME: The print services polling should probably be done in its
+ // own thread.
+ connection.setConnectTimeout( timeout );
+
+ int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK)
{