SFTP client using openssl

You don't say which port you're connecting to. Most FTP servers these days use explicit TLS on port 21 using the STARTTLS command. You will first need to talk the FTP protocol to issue the STARTTLS command and only after that can you talk TLS. You can test whether the server supports it like so:

openssl s_client -starttls ftp -connect ftp_server:port