The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Socket programming maracumbigo High Level Programming 4 02-10-2008 11:34 PM
C Network Programming - recv() help Octal High Level Programming 2 05-11-2007 10:33 PM
UDP socket - can both client and server recv and send rvan High Level Programming 1 05-08-2007 11:36 PM
Socket Programming socket soshell High Level Programming 2 06-29-2004 04:49 AM
TCP Programming problems with 'recv' KrazyGuyPaul IP Networking 1 09-12-2002 02:17 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 04-01-2004
Registered User
 

Join Date: Mar 2002
Location: Madison, WI
Posts: 5
recv syscall for socket programming

I have a question regarding the recv syscall.

Suppose I have a client/server and the following exchange of message took place:


Client --> Server using multiple send syscalls one after another immediately:

send "Packet1"
send "Packet2"
send "Packet3"




Server receives in the following order, taking a long time (couple of secs) to process each message received:

recv "Packet1"
-take 2 secs to process "Packet1"
recv "Packet2Packet3"


What throws me off is the second recv call that the server gets after processing the first recv call. The message is the contents of BOTH the packet 2 and packet 3 that the cilent sends.

It seems that recv reads whatever that is in the buffer, and not the sequence that message comes in. Is that true?

What I am planning to have is a server behaivor that is like this:

recv "Packet1"
- 2 sec of processing time
recv "Packet2"
- 2 sec of processing time
recv "Packet3"
- 2 sec of processing time


For example, since 3 messages are sent to the server, the server will have to call 3 recv explicity to get each individual message even though they are all already in the input buffer. Is that possible with recv?

Thanks
__________________
If only life is as simple as C...
Reply With Quote
Forum Sponsor
  #2  
Old 04-01-2004
Registered User
 

Join Date: Mar 2002
Location: Madison, WI
Posts: 5
Thanks, that make sense
__________________
If only life is as simple as C...
Reply With Quote
  #3  
Old 06-16-2008
Registered User
 

Join Date: Jun 2008
Posts: 2
Thanks, that make sense

hi,

i'm facing the same problem too,
i know the reason, but struggling to solve it.

i found there is a socket type which will recv, packets exactly in the same order sent, without reading the whole junk from buffer...

if u know a way, kindly post....

Thnx,
sri
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0