1
我很努力地在Ruby中实现clamd守护进程的INSTREAM命令。 这里是clamd如何在Ruby中实现INSTREAM协议?
@file = File.open("input.txt")
socket = TCPSocket.new(HOST, PORT)
#writing the command
socket.write("zINSTREAM\0")
#streaming the chunk
socket.write(1024) #size of chunk
socket.write(@file.read(1024)) #chunk of data
#end the streaming
socket.write(0)
puts "Reading from the scoket"
puts socket.recv(1024)
socket.close
文档,但我总是收到错误反应“INSTREAM大小限制超出。ERROR” 我做错了的是什么?
从您提供的文件链接:“流被终止注意:不要超过clamd.conf中定义的StreamMaxLength,否则clamd将以超出INSTREAM大小限制的方式回复并关闭连接上。”你的clamd.conf是什么? – unnu
我检查了clamd.conf。 StreamMaxLength 25M。 input.txt的内容不会超过25兆字节。 –
你确定必须在'zINSTREAM'命令后立即发送空终止符?它不应该只是'socket.write(“zINSTREAM”)'? – unnu