PowerBuilder
PowerBuilder
Get the FTP Server System Type (SYST)
See more FTP Examples
Demonstrates the Chilkat Ftp2.Syst method, which sends SYST and returns the server's operating-system type reply. It takes no arguments.
Background: The
SYST reply (for example UNIX Type: L8 or Windows_NT) hints at how the server formats things like legacy directory listings, which historically varied by platform. Chilkat uses it internally to parse such listings; you rarely need to call it directly, but it is useful for diagnostics or when adapting to an unusual server.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Ftp
string ls_SystemType
li_Success = 0
// Demonstrates the Ftp2.Syst method, which sends SYST and returns the server's operating-system
// type reply. It takes no arguments.
loo_Ftp = create oleobject
li_rc = loo_Ftp.ConnectToNewObject("Chilkat.Ftp2")
if li_rc < 0 then
destroy loo_Ftp
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Ftp.Hostname = "ftp.example.com"
loo_Ftp.Username = "myFtpLogin"
// 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.
loo_Ftp.Password = "myPassword"
// Connect and log in (Connect performs both).
li_Success = loo_Ftp.Connect()
if li_Success = 0 then
Write-Debug loo_Ftp.LastErrorText
destroy loo_Ftp
return
end if
// Chilkat can use the SYST reply when interpreting legacy directory listings.
ls_SystemType = loo_Ftp.Syst()
if loo_Ftp.LastMethodSuccess = 0 then
Write-Debug loo_Ftp.LastErrorText
destroy loo_Ftp
return
end if
Write-Debug "Server system type: " + ls_SystemType
li_Success = loo_Ftp.Disconnect()
if li_Success = 0 then
Write-Debug loo_Ftp.LastErrorText
destroy loo_Ftp
return
end if
destroy loo_Ftp