2023 To get started please write two programs which run on the CSE machines ie cse01 cse02 etc | Assignment Collections

Computer Science 2023 Computer Science Using C++

2023 To get started please write two programs which run on the CSE machines ie cse01 cse02 etc | Assignment Collections

 

To get started, please write two programs which run on the CSE machines (ie cse01, cse02, etc).  One will be a server, one will be a client.

This probably sounds very complicated, but your client and server are not going to do much more than send a string over the network and print it out.  It is about as basic of an assignment as we can have.

The purpose is to familiarize you with the Unix network API.  You have seen the steps needed to perform these tasks, now you can carry them out.

The server:

The server needs to create a TCP/IP socket.   This means a connected Internet socket.  Look at the socket(2) system call and study the parameters.  If you still don’t see how to create the socket, please ask.  I just want everyone to try on their own first.

Servers need to bind addresses.  What address will the server respond to?  You have the option of having the system fill in your local IP address.  You need to select a port to operate on.  A port is a way of indicating the application-level protocol.  Please pick a random number between 10K and 64K and use that for both your client and server.  Both programs need to agree on this port number.  If you get an error about “address already in use” then pick another port number.

After binding, you need to setup a connection queue to hold incoming clients.  It is possible for multiple clients to arrive at the same time, and you don’t want to miss them.  While your server should be quick about connecting to these clients, in practice one creates a small queue.  The listen(2) system call is used to create that queue.

The server should wait in a loop for new connections.  Servers usually have infinite loops for this, with some other way of exiting.  Terminating the program with ^C is an option.  Inside of the loop, the server should call accept(2).  Note that this will put the server to sleep until a client arrives.  When a client tries to connect to the server, the server will be woke and the accept() call completes.  Accept provides the server with the address of the new client.

The server should process any data sent from the client.  Real servers can have extended conversations with a client.  You just need to read one string.  You may assume that the string will fit in a 1500 byte packet.

Print that string out, along with the IP address of the client (in dotted decimal notation).  See inet_ntoa(3).

When the conversation is done, the server should use close(2) or shutdown(2) to end the conversation.  Accept will open a new connection for the next client.  You do not want to leave sockets open when the client disconnects, or you could fill up your open file table.

The client:

This is much simpler.  The client needs to create a socket, just like the server.  The client needs to create a struct sockaddr structure with the server’s address.  You may hard-code this address.  Later we will consider how you could discover that at runtime.

The client should connect(2) to the server.  Once connect returns successfully, you may write to the socket.  Be sure to close the socket when you are done.

The client only needs to send one string per run, and it may then exit.  The server sticks around until you shut it down.

 

We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.

Place Order Now

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational