The Program:
Design and implement a simple file transfer system, i.e., create a file transfer server and a file transfer client. Write the ftserve and the ftclient programs, and submit the two source code files. Write the program in C, java, or python! Include any pertinent makefiles and include instructions for executing the program in the program description comments. The final version of your programs must accomplish the following tasks:
1. ftserve starts on host A, and validates any pertinent command-line parameters.
2. ftserve waits on port 30021 for a client request.
3. ftclient starts on host B, and validates any pertinent command-line parameters.
4. ftserve and ftclient establish a TCP control connection on port 30021. (For the remainder of this description, call this connection P)
5. ftserve waits on connection P for ftclient to send a command.
6. ftclient sends a command (list or get <filename>) on connection P.
7. ftserve receives command on connection P.
a. If ftclient sent an invalid command, ftserve sends an error message to ftclient on connection P, and ftclient displays the message on-screen.
• ftserve initiates a TCP data connection with ftclient on port 30020. (Call this connection Q)
• If ftclient has sent the list command, ftserve sends its directory to ftclient on connection Q, and ftclient displays the directory on-screen.
• If ftclient has sent get <filename>, ftserve validates filename, and either
- sends the contents of filename on connection Q.   ftclient saves the file in the current default directory (handling "duplicate file name" error if necessary), and displays a "transfer complete" message on-screen
- sends an appropriate error message (“File not found”, etc.) to ftclient on connection P, and ftclient displays the message on-screen.
b. ftserve closes connection Q.
8. ftserve repeats from 5 (above) until the client closes connection P (don’t leave open sockets).
9. ftserve repeats from 2 (above) until terminated by a supervisor (don’t leave open sockets).

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

struct package{
    char buf[MAXDATASIZE];   

void *get_in_addr(struct sockaddr *sa)
    if (sa->sa_family == AF_INET) {
       return &(((struct sockaddr_in*)sa)->sin_addr);

    return &(((struct sockaddr_in6*)sa)->sin6_addr);

int main(void)
    fd_set master;    // master file descriptor list
    fd_set read_fds; // temp file descriptor list for select()
    int fdmax;       // maximum file descriptor number

    int listener;    // listening socket descriptor
    int newfd;       // newly accept()ed socket descriptor
    struct sockaddr_storage remoteaddr; // client address
    socklen_t addrlen;

    char buf[256];    // buffer for client data
    char buf1[256];
    struct package pa;
    int nbytes;

char remoteIP[INET6_ADDRSTRLEN];...
$98.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Network Management and Data Communication Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats