Discussion:
read() vs. recv() for sockets operations
(too old to reply)
Roman Mashak
2005-11-18 06:29:20 UTC
Permalink
Hello, All!

What are the benefits/drawbacks of using read() on socket operations, except
it's a general way for dealing with file descriptors? What about portability
etc.?

With best regards, Roman Mashak. E-mail: ***@tusur.ru
Måns Rullgård
2005-11-18 08:44:44 UTC
Permalink
Post by Roman Mashak
Hello, All!
What are the benefits/drawbacks of using read() on socket operations, except
it's a general way for dealing with file descriptors? What about portability
etc.?
recv() takes an extra flags parameter. That's the only difference.
--
Måns Rullgård
***@inprovide.com
Roman Mashak
2005-11-18 13:09:43 UTC
Permalink
Hello, Måns!
You wrote on Fri, 18 Nov 2005 08:44:44 +0000:

??>> What are the benefits/drawbacks of using read() on socket operations,
??>> except it's a general way for dealing with file descriptors? What
??>> about portability etc.?

MR> recv() takes an extra flags parameter. That's the only difference.
I assume, both functions are equally portable?

With best regards, Roman Mashak. E-mail: ***@tusur.ru
Valentin Nechayev
2005-11-18 11:59:03 UTC
Permalink
Fri, Nov 18, 2005 at 20:09:43, mrv (Roman Mashak) wrote about "read() vs. recv() for sockets operations":

RM> ??>> What are the benefits/drawbacks of using read() on socket operations,
RM> ??>> except it's a general way for dealing with file descriptors? What
RM> ??>> about portability etc.?
MR>> recv() takes an extra flags parameter. That's the only difference.
RM> I assume, both functions are equally portable?

For all Unix(-like) systems, yes. For Windows, no.


-netch-
Michel Bardiaux
2005-11-22 10:50:43 UTC
Permalink
Post by Roman Mashak
Hello, Måns!
??>> What are the benefits/drawbacks of using read() on socket operations,
??>> except it's a general way for dealing with file descriptors? What
??>> about portability etc.?
MR> recv() takes an extra flags parameter. That's the only difference.
I assume, both functions are equally portable?
On Unix, read or recv will do exactly the same (apart from the flags
thing). On Windows, read() on a socket is not allowed. So, for
portability it is better to use recv for all sockets.
--
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:***@mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/
Loading...