Skip to content

Commit

Permalink
Merge pull request #363 from mike42/development
Browse files Browse the repository at this point in the history
Changes for release 1.5.2
  • Loading branch information
mike42 authored May 18, 2017
2 parents 11d8ed8 + 9bbc673 commit bb24755
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Many thermal receipt printers support ESC/POS to some degree. This driver has be
- P-822D
- P85A-401 (make unknown)
- Rongta RP326US
- Rongta RP58-U
- SEYPOS PRP-300 (Also marketed as TYSSO PRP-300)
- Silicon SP-201 / RP80USE
- Star TSP100 ECO
Expand Down
9 changes: 7 additions & 2 deletions src/Mike42/Escpos/PrintConnectors/NetworkPrintConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ class NetworkPrintConnector extends FilePrintConnector
*
* @param string $ip IP address or hostname to use.
* @param string $port The port number to connect on.
* @param string $timeout The connection timeout, in seconds.
* @throws Exception Where the socket cannot be opened.
*/
public function __construct($ip, $port = "9100")
public function __construct($ip, $port = "9100", $timeout = false)
{
$this -> fp = @fsockopen($ip, $port, $errno, $errstr);
// Default to 60 if default_socket_timeout isn't defined in the ini
$defaultSocketTimeout = ini_get("default_socket_timeout") ?: 60;
$timeout = $timeout ?: $defaultSocketTimeout;

$this -> fp = @fsockopen($ip, $port, $errno, $errstr, $timeout);
if ($this -> fp === false) {
throw new Exception("Cannot initialise NetworkPrintConnector: " . $errstr);
}
Expand Down

0 comments on commit bb24755

Please sign in to comment.