Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

I am developing an embedded client application for a Telit GPRS modem. The client application checks a POP3 server for new mail.

I am having trouble with receiving data from the server.

Does the POP3 server send the data as a continuous stream of data to the client or does it send the data one line at a time to the client???

Thank you and regards
Posted

You do it all on a single TCP connection. You connect, authenticate, and then send POP3 commands, and the server sends back responses, some of which are multi-line.

What class are you using for this? Or did you roll your own?

[Edit]
-------

In response to your comment:

The response to a RETR is send as a single response. At the receiving end you may receive it through multiple iterations because of internal buffer limits. But it is not broken down into lines. If you don't want to read the entire mail body, and just want to see the from/to/subject use TOP instead of RETR.
 
Share this answer
 
v2
Comments
sach262 4-Nov-10 11:35am    
I am writing my own code in python because the GPRS modem has an embedded python engine. So the entire application is embedded inside the GPRS modem. I cannot use built in python pop library because of the special GPRS commands of the modem.

Anyway I have successfully implemented the POP3 protocol, downloading entire header information etc. But I am now trying to streamline my application by only processing specific lines from the server response such as the "from" and "subject" lines.

I am aware that the server sends multi-line responses, but are they sent as a continuous stream of bytes or are they sent one line at a time?
Nish Nishant 4-Nov-10 11:41am    
The response to a RETR is send as a single response. At the receiving end you may receive it through multiple iterations because of internal buffer limits. But it is not broken down into lines. If you don't want to read the entire mail body, and just want to see the from/to/subject use TOP instead of RETR.
sach262 4-Nov-10 11:45am    
Ok cool thanks Nishant bhai. Since it is an embedded application buffer size is an issue. I will store the entire response in a string and then start processing it.

Thank you
Nish Nishant 4-Nov-10 11:46am    
You are welcome.
When required, multiline responses are sent uninterrupted. Depending on the library/language you're using, you may be able to read from your buffer (client side) line-by-line. Just be careful that you handle the end of the stream gracefully if it's not properly terminated.

RFC 1939[^]

You'll do well to open a telnet session and poke at the server to see what it does.

Cheers.
 
Share this answer
 
Comments
sach262 4-Nov-10 11:42am    
Thanks James. Ok Looks like I will have to receive the entire stream and then start my processing on it. I have tried to process the data line by line inside the modem using the modem's python engine but this does not work well compared to processing line by line on a pc C# application for example.
TheyCallMeMrJames 4-Nov-10 11:57am    
You bet. You will still have line terminations in the stream, so check to see if it's giving you chars 13 & 10 and that will help you split the lines up to suss out the subject, etc. Cheers.
sach262 4-Nov-10 13:06pm    
aah yes line feed and carriage return. I shall check \r\n then at each line to split it up.
Thanks alot!
Can anyone help me to resolve this?
email validation problem[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900