Jump to content

Should I retry some commands during a POP3 session?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
kremuwa

kremuwa

    Newbie

  • Members
  • Pip
  • 5 posts
Hello,

I'm writing a peer2mail client. To connect to the mailboxes I use pop3 protocol. I'm connecting to a pop3 server and downloading some mails using commands like:
- USER
- PASS
- STAT
- TOP
- RETR

I want the program to be as reliable as possible. I'd like to ask you then, if I should retry sending some commands in case of their failure. If so, which of them and how many times? Should I retry the connection to pop3server itself?

Thank you in advance for your effort,
Michael. :)

#2
kremuwa

kremuwa

    Newbie

  • Members
  • Pip
  • 5 posts
Refresh.

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
What you should do is act properly based on the protocol, not just randomly resend commands.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
kremuwa

kremuwa

    Newbie

  • Members
  • Pip
  • 5 posts
My program works well, I do it properly but sometimes for example RETR function is failing from unknown reason - when I start again, it works. So I came to think I should retry some commands if they fail - that's the reason of my question.

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Is it a network issue, perhaps?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
kremuwa

kremuwa

    Newbie

  • Members
  • Pip
  • 5 posts
You may be right. I think it'll be good to retry sending RETR comand in the case of its failure, because it takes a lot of time to read a response for such a command and issues are more possible... maybe?

#7
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
You may want to try diagnosing it with a command-line telnet prompt, to see what's happening.

Things that cross my mind: Are you sure you're still in a TRANSACTION state when issuing RETR? What's the exact response that indicates failure? If the connection is interrupted or times out, that would cause you to lose the TRANSACTION state, and make RETR an invalid command, for example.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#8
kremuwa

kremuwa

    Newbie

  • Members
  • Pip
  • 5 posts
I will let you know as soon as I get this error again.