diff --git a/app/Classes/Protocol/EMSI.php b/app/Classes/Protocol/EMSI.php index ab9a498..c2b6a59 100644 --- a/app/Classes/Protocol/EMSI.php +++ b/app/Classes/Protocol/EMSI.php @@ -943,10 +943,35 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface // Peek for the next 2 chars do { $iac = $this->client->read(10,1,MSG_PEEK); + $iaccmd = NULL; + + switch (ord($iac)) { + case 0x00: + if ($iaccmd === 0xfb) { + Log::debug(sprintf('%s: - IAC WILL BINARY [%02x]',self::LOGKEY,ord($iac))); + + // Config with DO + $this->client->send(chr(0xff).chr(0xfd).$iac); + } elseif ($iaccmd === 0xfd) { + Log::debug(sprintf('%s: - IAC DO BINARY [%02x]',self::LOGKEY,ord($iac))); + + // Config with WILL + $this->client->send(chr(0xff).chr(0xfb).$iac); + $this->client->iac_bin = true; + } + + case 0xfb: + Log::debug(sprintf('%s: - IAC WILL [%02x]',self::LOGKEY,ord($iac))); + $iaccmd = ord($iac); + break; + + case 0xfd: + Log::debug(sprintf('%s: - IAC DO [%02x]',self::LOGKEY,ord($iac))); + $iaccmd = ord($iac); + break; - switch ($iac) { default: - Log::debug(sprintf('%s: - IAC [%02x]',self::LOGKEY,$iac)); + Log::debug(sprintf('%s: - IAC [%02x]',self::LOGKEY,ord($iac))); $iac = NULL; } diff --git a/app/Classes/Sock/SocketClient.php b/app/Classes/Sock/SocketClient.php index cb3e61b..fd6db86 100644 --- a/app/Classes/Sock/SocketClient.php +++ b/app/Classes/Sock/SocketClient.php @@ -197,6 +197,7 @@ final class SocketClient { return match ($key) { 'address_remote', 'port_remote' => $this->{$key}, 'cps', 'speed' => Arr::get($this->session,$key), + 'iac_bin' => Arr::get($this->session,$key), 'rx_free' => self::RX_BUF_SIZE-$this->rx_left, 'rx_left' => strlen($this->rx_buf), 'tx_free' => self::TX_BUF_SIZE-strlen($this->tx_buf), @@ -210,6 +211,7 @@ final class SocketClient { switch ($key) { case 'cps': case 'speed': + case 'iac_bin': $this->session[$key] = $value; break;