title: Unable to receive large array using sockets in c
body: <p>I am sending integer array of size from one raspberry pi to another using POSIX sockets in C. I am writing an integer array of size 131072 from one pi, the return value from the write command shows that all 131072 values have been written. <code>ret = write(socket, &amp;array, sizeof(array))</code> Using the same method for receive <code>ret = read(socket, &amp;array, sizeof(array))</code> shows that all the sent values are not been read rather the number of values read correctly is also not constant but varies between 10000 to 20000.</p>
  
  <p>I tried to use the read function inside a loop where I read integer in each loop iteration</p>
  
  <pre><code>for(int i =0; i&lt;131072; i++){
  ret = read(socket, &amp;value, sizeof(value));
  data[i] = value;}
  </code></pre>
  
  <p>I was able to receive all the values with no error or losses.</p>