creating a python client or java client and using unix commands with the client

There are numerous tutorials explaining the basics of socket based network programming. The in-class examples described how Unix TCP/IP sockets use the metaphor of telephone switchboard “sockets” and the sequence of operations performed by old fashioned telephone exchanges:

On the server:

  • Create a socket and Bind the socket to a port
  • Have the socket Listen for a connection on the bound port (the phone to ring)
  • Accept a connection (answer the phone)
  • Communicate bi-directionally (talk back and forth)
  • Close the connection (hangup)

On the client:

  • Create a socket
  • Connect the socket to a server on a specified port (dial the server’s phone number and extension)
  • Communicate bi-directionally (talk back and forth)
  • Close the connection (hangup)

For more: Read the sockets entire tutorial at http://www.javaworld.com/article/2077322/core-java/core-java-sockets-programming-in-java-a-tutorial.htmlfor more background and step by step instructions. Also read https://docs.oracle.com/javase/tutorial/networking/sockets/

There is a Python socket programming tutorial at https://docs.python.org/2/howto/sockets.html

Procedure

Students may implement the following features in either Java or Python. There is no need to write solutions in both languages. One or the other is sufficient. Please use Windows or Linux.

Simple client and server socket code samples are posted in Ppilot, please download the files from Pilot–>Content–>Resources–>Networking:

Java – JavaScoketSever.java, JavaSocketClient.java

python – client2.py, server2.py

Submit the following files to Pilot Dropbox:

1) A plain text answer file (lab10-lastname-firstname.txt)

2) Your well-documented client and server socket programs that meet the following requirements. If you collaborate with other students to complete this project, you must list all involved student names in a comment at the top of every file submitted.

Part 1 (1 point):

Build and test either the Python client and server socket code in Pilot or the Java client and server socket code in Pilot. Provide evidence of the tests you performed to assure that your client and server programs work. For example, copy and paste the input and output from your client and server programs into lab10-lastname-firstname.txt.

Part 2: (5 points)

Modify the server to accept commands in the form of strings: “ls”, “get”, “put”, “quit“.

a) Implement “ls” to return a string containing a listing of the contents of the server’s C: drive ( in Windows ) or your home directory (in Linux).

  1. Client sends ‘ls’
  2. Server performs file listing ( Using system commands such as dir/ls or python/java methods/functions) and sends that output to the client
  3. Client prints the message received from the server

b) Implement “get” to read bytes from a named file on the server and send the bytes to the client as a string. e.g. “get anotherFile.txt

  1. Client sends ‘get filename’ (filename should be replaced with a named file on the server)
  2. Server reads the content of the file and sends it to the client
  3. Client prints the message received from the server

c) Implement “put” to read bytes from a named file on the client and send the bytes to the server as a string. e.g. “put anotherFile.txt

  1. Client sends ‘put filename’
  2. Client reads the file and sends file content to the server
  3. Server prints the message received from the client

d) Implement “quit” to close the socket connection

e) Implement the client side to accept input from a user and display output from the server: e.g. a client user can typels[enter]” and see the listing of files on the server’s C: drive

In your answers file, provide detailed instructions for compiling/running your client and server programs.

In your answers file, provide evidence of the tests you performed to assure that your client and server programs work. For example, copy and paste the input and output from your client and server programs. The text you paste must show that each required command was executed and required results were returned from the server.

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.

Do you need a similar assignment done from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount! Use Discount Code "save15" for a 15% Discount!

Request essay help

You can trust us for this and even for your future projects