This is incorrect due to operator precedence:
while ((t = read(clientsocket, buff, 128) > 0))
and results in t
being assigned the result of read(clientsocket, buff, 128) > 0
, which will be 0
or 1
.
To correct, change to:
while ((t = read(clientsocket, buff, 128)) > 0)