I have written a single server-client program and I want to ask: Is there any difference in the behavior of the recv() function between 32 and 64 bit operating systems.
I am asking this because I am running both the server and the client on a 64 bit laptop and everything is working fine. I call recv() this way:while((tmp = recv(client_sock,rec_msg,256,0))>0) and as expected if for example i have 3 strings to send from client,in the server part it enters the while 3 times and prints the right result.
When i run exactly the same programs on a 32 bit Debian machine it seems that for some unknown reason if i send 3 strings for example from client it enters the while loop in server part only one time and receives the 3 strings as one.
I have used print statements and found out that it enters the while loop one time and receive all the buffer although in the client part while loop is entered 3 times as expected and 3 strings are sent in 3 different times. I can’t found a logical reason for why it is working fine on 64 bit and not working in 32 bit and that’s why i am asking this question.
Thanks in advance for your time and your help.
If this is a stream socket, then there are no inherent message boundaries, and there’s no correlation between the messages sent and received.
recv()may return part of a message, the whole message, or multiple messages; all that’s guaranteed is that the bytes are received in the same order that they were sent.The difference you’re seeing is probably just due to speed differences between the two machines. The 32-bit machine is slower, so in the time it takes to check for data being available on the network all 3 packets have arrived. But the faster 64-bit machine processes the received data from the first packet before the second one arrives.