Added timeout and fixed .recv() problem