java - File upload to ftp and sftp -


i stuck in problem. according latest requirement, have upload file ftp or sftp server. problem don't know server ftp or sftp. on runtime client provide ip , other details of server have upload file. so, in runtime have understand server ftp or sftp , need act accordingly. so, there way out on this?

sftp (ssh file transfer protocol) uses port 22 default.

some people use "sftp" denote ftps (ftp-over-tls). in case have 2 options: explicit tls , implicit tls. implicit tls uses port 990 default. in explicit mode client connects port 21 default , tells server start tls handshake on existing connection.

plain ftp uses port 21.

now, user can able specify explicitly protocol use.

finally can try connect, grab first line of data socket , analyze it. in ftp/ftps first line should start 220sp (sp stands space, character code of 0x20). other response code can given well. in ssh/sftp line starts "ssh-2.0-" .


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -