Difference Between Send & Write, Recv & Read

I’ve seen this a few times and asked too, what’s the difference between Send & Write, Recv & Read in the RSocket API. The answer is, very simple: Both Write and Read are just wrappers over Send and Recv, providing a default value (0), for the flags parameter (the flags can specity options like reading out of band data or peeking into the available socket buffer. The default value just reads, nothing special).

IMPORT_C void Write(const TDesC8 &aDesc, TRequestStatus &aStatus);
IMPORT_C void Send(const TDesC8 &aDesc, TUint flags, TRequestStatus &aStatus);

IMPORT_C void Read(TDes8 &aDesc, TRequestStatus &aStatus);
IMPORT_C void Recv(TDes8 &aDesc, TUint flags, TRequestStatus &aStatus);

The reason its like this is probably because of the BSD Socket APIs, which have analogous functions and is for maintaining compatibility I think. It should be noted that Microsoft skipped Read/Write in Winsock, for this reason I guess.

One thought on “Difference Between Send & Write, Recv & Read

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s