socket functions just send series of bytes.
The str functions always expect that their input is zero terminated.
You need to either come up with something that zero terminates your arrays (keep track of the number of received bytes) or dont use the str functions.