Networking Forums

Networking Forums > Computer Networking > Linux Networking > Socket Server... Why two?

Reply
Thread Tools Display Modes

Socket Server... Why two?

 
 
djake@excite.it
Guest
Posts: n/a

 
      12-13-2004, 08:45 AM
What's the difference between a socket server done in this way:

accept() -> select() -> recv() --- in a blocking way ---

And a socket server done in this way?

accept() -> recv() --- in a blocking way ---

Both wait for data to be received before to unblock. But what's the
advantage and disavantage in the first and in second solution?

Thanks in advance
 
Reply With Quote
 
 
 
 
Simon J. Rowe
Guest
Posts: n/a

 
      12-13-2004, 09:48 AM
(E-Mail Removed) wrote:

> What's the difference between a socket server done in this way:
>
> accept() -> select() -> recv() --- in a blocking way ---
>
> And a socket server done in this way?
>
> accept() -> recv() --- in a blocking way ---
>
> Both wait for data to be received before to unblock. But what's the
> advantage and disavantage in the first and in second solution?


You are correct, there's little functional difference between the two. The
first example is what you would use if you put the socket into non-blocking
mode, this would allow you to handle other events in addition to receiving
packets.
 
Reply With Quote
 
Pirabhu Raman
Guest
Posts: n/a

 
      12-13-2004, 03:26 PM

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> What's the difference between a socket server done in this way:
>
> accept() -> select() -> recv() --- in a blocking way ---
>
> And a socket server done in this way?
>
> accept() -> recv() --- in a blocking way ---
>
> Both wait for data to be received before to unblock. But what's the
> advantage and disavantage in the first and in second solution?


In the first case you could wait on more than one descriptor (sockets,
files) at the same time and be notified of any events including availability
of data, ready for write etc and hence used mostly in cases where you have
multiple connections. Also, you have a option of specifying the amount of
time to block.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find UDP socket is closed in client and server program in C sandeep Linux Networking 1 09-22-2006 12:18 PM
How do I redirect server's standard output to socket? thisrule@gmail.com Linux Networking 0 12-29-2005 06:30 AM
Socket programming, detect if client or server has gone away Frank de Bot Linux Networking 1 12-21-2004 01:22 PM
[Q]how may socket connection can established per server at the same time. ÀÌ»ó¼ö Windows Networking 0 09-09-2004 01:02 AM
Socket Create Error 10022 in Server 2003 David Dunetz Windows Networking 0 09-01-2004 05:50 PM



1 2 3 4 5 6 7 8 9 10 11