Added connect, missing packets and using binary mode for files