Update packet.rb

eof? method can fail to recognise EOF, possibly depending on encodings. By explicitly unpacking the packet, the EOF packet first byte is always correctly recognised