Small issues with using socket to connect to the POP3 server

Source: Internet
Author: User
Use SOCKET to connect to the POP3 server. I use encoding. ASCII for character encoding.
1. send command user <username> \ r \ n
+ OK
2. send command pass <password> \ r \ n
+ OK
3. Send command list \ r \ n
At this time, if you immediately go to socket. Receive (bytes), sometimes you can only get + OK \ r \ n,
However, you cannot obtain complete data packets. Although you can use socket. available to determine the data volume, you can still obtain incorrect data.
Therefore, after sending the LIST Command, we recommend that you use thread. Sleep (100) to delay and then receive socket data.
When you use RETR <n> \ r \ n to receive mail content, it is best to set up a delay.

The POP3 server has a time-out limit. A Noop command should be issued in seconds to maintain the connection.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.