read() vs. recv() for sockets operations
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > read() vs. recv() for sockets operations




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    read() vs. recv() for sockets operations  
Roman Mashak


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-18-05 07:49 AM

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: mrv@tusur.ru







[ Post a follow-up to this message ]



    Re: read() vs. recv() for sockets operations  
Måns Rullgård


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-18-05 07:49 AM

"Roman Mashak" <mrv@tusur.ru> writes:

> Hello, All!
>
> What are the benefits/drawbacks of using read() on socket operations, exce
pt
> it's a general way for dealing with file descriptors? What about portabili
ty
> etc.?

recv() takes an extra flags parameter.  That's the only difference.

--
Måns Rullgård
mru@inprovide.com





[ Post a follow-up to this message ]



    Re: read() vs. recv() for sockets operations  
Roman Mashak


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-18-05 12:50 PM

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: mrv@tusur.ru







[ Post a follow-up to this message ]



    Re: read() vs. recv() for sockets operations  
Valentin Nechayev


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-18-05 12:50 PM

Fri, Nov 18, 2005 at 20:09:43, mrv (Roman Mashak) wrote about "read() vs. re
cv() for sockets operations":

RM>  ??>> What are the benefits/drawbacks of using read() on socket operatio
ns,
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-





[ Post a follow-up to this message ]



    Re: read() vs. recv() for sockets operations  
Michel Bardiaux


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-22-05 12:50 PM

Roman Mashak wrote:
> 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: mrv@tusur.ru
>
>
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:mbardiaux@mediaxim.be

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





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:41 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register