-Program Specification This program is based on Client/Server architecture, used to transfer a file from server to client. With TCP socket programming, the client sends messages to server, specifying the file name. The server looks up the current directory with the same file name. If found, then sends them to the client, and the client saves them in the current directory with the same file name. If not found, the server sends a message containing information “File not found!” to the client. -Experimental Goal The goal of this program is to transfer file. Client can transfer file from server one by one until it stops inputting. -Principle First server and client make the same port that is used to transfer files. Then give the IP address to client. Then TCP protocol has been built up. First, start server, and then start client. Client input a file name and put it into an output stream. Send this output stream to server. Server reads message and judge if the file exists. If not, send an output stream including message that “File not found!” . If found, then get the length of the file. Send 1024 bytes once in a stream to client until all file transferred. Client received the file and saved them in the current directory. |
查看评论
已有0位网友发表了看法