Project 1: A Simple Client/Server Project
- Practice socket programming
- Design and build a client-server application
For the project, you will write two programs. A client and server application running on your localhost and a remote server host ([login to view URL]).
The two programs will be called pingClient and pingServer. You can use any programming language you want for this. The general architecture will look like this:
Your pingClient will allow the user to enter in a domain name (e.g. [login to view URL]). The client host will establish a TCP connection to the cs1 server host. The pingClient app will send the domain name entered by the user to the pingServer app running on the cs1 server.
PingServer will then ping the domain name (provided by pingClient) locally (at least 20 times) and return the following information to the pingClient.
- Domain name tested (echo the domain name back to client)
- # of packets transmitted (pings)
- # of packets received (successful pings) - % of packet loss
- Average rtt time.
pingClient will then display this information to the user. Format should be similar to this:
- Domain tested was: [domain].
- [number] pings were sent with [number] pings succeeding.
- [%] % of packets were lost
- The average RTT was: [time in seconds]
The client program must run in the command line:
e.g. pingClient [domainToTest]@hostname:server_port, which sends [domain name to test] to pingServer running on server_port at the computer specified by hostname (this is [login to view URL]). (No space is between hostname and server_port.) See Testing Environment section for port assignment.
Instead of developing a new ping service on your own, just use the ping service provided by Unix/Linux.
Being a multi-client server, the pingServer application should handle multiple concurrent connections. Your undergraduate OS course should have prepared you with these skills.
Background – Socket Programming:
There are several system calls that you may need to use for this project:
• Parsing addresses: getaddrinfo() Given node and service, which identify an Internet host and a service, getaddrinfo() returns one or more addrinfo structures, each of which contains an Internet address that can be specified in a call to bind() or connect().
• Setting up a connection: socket() Get a descriptor to a socket of the given typeconnect() Connect to a peer on a given socket
• Creating a server socket: bind() Assign an address to a socket listen() Tell a socket to listen for incoming connections accept() Accept an incoming connection
• Communicating over the connection: read(), write() Read and write data to a socket descriptor htons(), htonl(), ntohs() , ntohl() Convert between host and network byte orders (and vice versa) for 16 and 32bit values You can find the details of these functions in the Unix/Linux man pages (most of them are in section 2) and/or Google search.
Port numbers between 10000 and 13000 are open in the server for your project use. To avoid port collision with your classmates, use the following port based on your initials:
CA, port 10200
NB, port 10400
MB, port 10600
RH, port 10800
MJ, port 11000
OK, port 11200
SP, port 11400
SR, port 11600
HS, port 11800
AS, port 12000
PW, port 12200
Understand the Protocol
In this project, TCP is the transport protocol used for data communication between the client host and server host. TCP provides a reliable in-order byte stream and it has no message boundary. The pingClient and the pingServer applications must define their own application-layer protocol to communicate with each other.
Hi there! I'm an expertise Python developer who already worked with TCP sockets and with strong fundamentals in networking. I can deliver your project request in 2 days, asap, fulfilling all the requirements: a TCP so Mai multe
2 freelanceri licitează în medie 28$ pentru acest proiect
Hello, I am professional freelancer with a Master's degree in Data analytics making me a suitable person for your project. I have more than 8 years of professional experience in Data analysis. Besides, I have skills i Mai multe