Some issues that occur to me:
The obvious problem is that there is no error checking.
memset
is often preferred tobzero
, although I don't see why. Also the cast ofserverAddr
tochar*
in thebzero
call is unnecessary.port number should be shared in a header file
is
inet_addr
the correct way to get the address? Also note that it, too, can fail. And there is usually anmemcpy
involved in creating the address structure.does calling
shutdown
have any purpose?putting a 1k buffer on the stack would be a bad idea in some small systems
the issue of
read
not returning all of what was written (or being interrupted) was already mentioned. Alsoread
returnsssize_t
notint
orsize_t
.finished variable is redundant.
Trivia
Usage message might use argv[0] instead of assumed executable name. Also the host must be a dotted address not a name.
exit status might prefer EXIT_FAILURE
I'd put "Response from server" in the format string.