Solution and Explanation:
"The read() call may block until data becomes available"
This is true for Blocking read, false if Non-Blocking read
There are 2 kinds of read() call
1)Blocking (Reader will block until some data is there for read)
2)Non-Blocking (Reader won't blocked, but ERROR status will be returned)
To make Non-Blocking we have to call
fcntl(pipeFDs[1], F_SETFL, O_NONBLOCK);
If Non-Blocking read() call won't block the process, Error status EAGAIN will be returned instead of number of bytes read.
If Blocking (By Default) , read() call will block the process until some bytes write by writer .
When the read() call returns, this one call will return all of the data that was sent through the pipe, which is different behavior than if this was a socket "This is false"
For Both Socket and Pipe Read will give bytes based on Buffer size specified.
IF More Bytes available than given buffer size, only bytes that can be fit it Buffer capacity will be copied to Buffer. Next Bytes will be given in next read() call
If Less or equal number of bytes to Buffer size is available, all will be copied to buffer