byte/string management for py3 comptability

* explicitely convert commands to bytes
* use bytes when interacting with the buffer read from socket.