[prev in list] [next in list] [prev in thread] [next in thread] 

List:       imap
Subject:    RE: getting header data from IMAP server.
From:       "Larry Osterman (Exchange)" <larryo () exchange ! MICROSOFT ! com>
Date:       1997-06-02 19:12:17
[Download RAW message or body]


Larry Osterman
Via Exchange Osmium on Lothair with NT 4.0.  Since these are not all
released products, please notify the sender of any difficulties.


> ----------
> From: 	Danan Sudindranath[SMTP:dananjs@umich.edu]
> Sent: 	Saturday, May 31, 1997 5:38 PM
> To: 	imap@u.washington.edu
> Subject: 	getting header data from IMAP server.
> 
> 
> Hello, 
> 
> I've finally got some functions working that send commands and receive
> responses from an imap server. Sending was easy enough since I know
> exactly how much data is in my command. 
> 
> A few questions though:
> 
> 1) right now when I'm receiving responses, I am returning from my
> receiving function when the buffer fills, or when the last received
> byte
> is a '\n', indicating the end of a response line.  The responses seem
> to
> be erratic and in pieces, however.  So do I have to piece together
> responses from the bits that I receive?
*****
Whenever you write code that interfaces with TCP/IP, you MUST piece
together responses from the bits that you receive.   There's this cute
little feature of TCP/IP called "IP fragmentation", that requires that
you assemble messages from the server together.

Basically the network layer beneath your code can feel free to cut up a
buffer from the server in whatever pieces it wants (even 1 byte at a
time), and the application on the other side of the connection just
needs to deal with it.

Think of your TCP/IP connection as a hose that has a faucet at each end.
The water (your data) is put into the hose at the server, and taken out
at your end.  But someone might turn the water off and on at the server
end (or at the client end), without effecting the data you get.  You
need to be prepared to take the data in whatever size fragments that
TCP/IP (the fawcets) give you.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic