Add null terminator and timeout to c client