Sample code for 30+ languages & platforms
Visual FoxPro

Send an SSH IGNORE Message

See more SSH Examples

Demonstrates the Chilkat Ssh.SendIgnore method, which sends an SSH IGNORE message. It takes no arguments. The server does not reply, but a successful send helps confirm the connection is still writable. No channel is required.

Background: The SSH IGNORE message is discarded by the peer by design; its usefulness is as a lightweight keep-alive or liveness probe. Because it exercises the actual write path, a successful SendIgnore is stronger evidence than CheckConnection that the link is still usable, without side effects on any channel.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loSsh
LOCAL lnSshPort
LOCAL lcPassword

lnSuccess = 0

*  Demonstrates the Ssh.SendIgnore method, which sends an SSH IGNORE message.  It takes no
*  arguments.  The server does not reply, but a successful send helps confirm the connection is
*  still writable.  No channel is required.

loSsh = CreateObject('Chilkat.Ssh')

*  Connect to the SSH server.  Port 22 is the usual SSH port.
lnSshPort = 22
lnSuccess = loSsh.Connect("ssh.example.com",lnSshPort)
IF (lnSuccess = 0) THEN
    ? loSsh.LastErrorText
    RELEASE loSsh
    CANCEL
ENDIF

*  Normally you would not hard-code the password in source.  You should instead obtain it
*  from an interactive prompt, environment variable, or a secrets vault.
lcPassword = "mySshPassword"

lnSuccess = loSsh.AuthenticatePw("mySshLogin",lcPassword)
IF (lnSuccess = 0) THEN
    ? loSsh.LastErrorText
    RELEASE loSsh
    CANCEL
ENDIF

*  Send an IGNORE message to verify the connection is still writable.
lnSuccess = loSsh.SendIgnore()
IF (lnSuccess = 0) THEN
    ? loSsh.LastErrorText
    RELEASE loSsh
    CANCEL
ENDIF

? "IGNORE message sent."

loSsh.Disconnect()

RELEASE loSsh