add testing for error messages and add a time out to data reads
for improved flexibility.
fix compilation error.
improve output formatting.
make line input from socket multi-thread safe.