Why we need to read() before write() in TCP server program?
Posted
by Naga
on Stack Overflow
See other posts from Stack Overflow
or by Naga
Published on 2010-03-20T18:48:25Z
Indexed on
2010/03/20
18:51 UTC
Read the original article
Hit count: 304
Hi,
As per my understanding a simple TCP server will be coded as follows.
socket() - bind() - listen() - accept() - read() - write()
The clients will be written as follows.
socket() - bind()(Optional) - connect() - write() - read()
Please note the order difference in read() and write() calls between client and server program.
Is it a requirement to always read() before write() in a server program and if, then why?
Thanks, Naga
© Stack Overflow or respective owner