FTP upload via sockets

后端 未结 5 740
一生所求
一生所求 2021-01-26 16:15

how can I upload a file with sockets to a ftp server? I am reading something with \"STOR\" in RFC...It is the same how i transfer a file between two computers?A sample code woul

5条回答
  •  醉梦人生
    2021-01-26 17:01

    Instead of uploading a file to a ftp I'd suggest that you write your own server and client software and have them communicate with eachother if you want to learn to use sockets in java.

    When you have learned that you can read the RFC for ftp which should tell you how to communicate with the FTP server. You need to learn and understand the ftp protocol in order to construct valid packets with data to send and in order to parse the data you receive from the ftp server.

    its usually requests, responses and data sent back and forth.

    Filedata itself is just sent in its raw form unless the ftp server requires encryption, but requests and responses can be in any form, binary values, decimal values, strings etc all depending on the protocol and the type of request.. You need to know this to setup a valid communication channel.

    I don't know the ftp protocol myself so I'm just demonstrating examples so you'll easier understand what it's all about.

提交回复
热议问题