PureBasic
PureBasic
Send a POP3 NOOP Command
See more POP3 Examples
Demonstrates the Chilkat MailMan.Pop3Noop method, which sends a POP3 NOOP command to the server. NOOP does nothing except elicit a positive response, which is useful for keeping a session alive or verifying the connection is still responsive. This example begins a POP3 session and sends a NOOP.
Background:
NOOP ("no operation") is a standard keep-alive across many internet protocols. Servers often drop idle connections after a timeout; sending a periodic NOOP resets that timer so a long-running session stays open. It also serves as a cheap "are you still there?" probe — a successful reply confirms the socket and the authenticated session are still healthy.Chilkat PureBasic Downloads
IncludeFile "CkMailMan.pb"
Procedure ChilkatExample()
success.i = 0
; Demonstrates the MailMan.Pop3Noop method, which sends a POP3 NOOP command to the server.
; NOOP does nothing except elicit a positive response, which is useful for keeping a
; session alive or verifying the connection is still responsive.
mailman.i = CkMailMan::ckCreate()
If mailman.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Configure the POP3 server connection.
CkMailMan::setCkMailHost(mailman, "pop.example.com")
CkMailMan::setCkMailPort(mailman, 995)
CkMailMan::setCkPopSsl(mailman, 1)
CkMailMan::setCkPopUsername(mailman, "user@example.com")
CkMailMan::setCkPopPassword(mailman, "myPassword")
; Begin a POP3 session.
success = CkMailMan::ckPop3BeginSession(mailman)
If success = 0
Debug CkMailMan::ckLastErrorText(mailman)
CkMailMan::ckDispose(mailman)
ProcedureReturn
EndIf
; Send a NOOP to keep the session alive.
success = CkMailMan::ckPop3Noop(mailman)
If success = 0
Debug CkMailMan::ckLastErrorText(mailman)
CkMailMan::ckDispose(mailman)
ProcedureReturn
EndIf
Debug "POP3 NOOP succeeded."
CkMailMan::ckDispose(mailman)
ProcedureReturn
EndProcedure