jonjomckay / quahog

A PHP client library for the ClamAV clamd daemon
MIT License
80 stars 23 forks source link

How to connect using IP:PORT using TCPv4, but not Unix socket? #36

Closed tomekit closed 3 years ago

tomekit commented 5 years ago

Does this library support connecting over TCPv4 in order to use scanstream? If so, would you mind showing an example? Much appreciated !

jonjomckay commented 5 years ago

Yep! You should be able to just pass ip:port in the call to createClient, instead of a socket URI

robincsamuel commented 4 years ago

@tomekit You can just do,

$socket = (new \Socket\Raw\Factory())->createClient('192.168.1.1:3310');
$quahog = new \Xenolope\Quahog\Client($socket, 30, PHP_NORMAL_READ);
$quahog->scanFile(...);

Passing PHP_NORMAL_READ as the mode as I got an error on PHP 7.3.

I hope that helps someone.

@jonjomckay Thanks for the package :)

jonjomckay commented 3 years ago

I've added a snippet the the README.md that should show others how to achieve this. Thanks all!