[Solved] CSE5306 Lab1- Client server architecture

$25

File Name: CSE5306_Lab1-_Client_server_architecture.zip
File Size: 376.8 KB

SKU: [Solved] CSE5306 Lab1- Client server architecture Category: Tag:
5/5 - (1 vote)

Objectives:

  1. An introduction to sockets.
  2. Exposure to thread management.

Project Specification:

These will be individual projects. You may write the program in any language that is supported under any Integrated Development Environment (IDE). Keep in mind that available controls, objects, libraries, et cetera, may make some of these tasks easier in one language than in another. Finally, because of the lack of restrictions on IDEs, you will have to have that IDE available to demo to the TA (e.g., you will demo the program on your own laptop).

All components should be managed with a simple GUI. The GUI should provide a way to kill the process without using the exit button on the window.

You will write a system consisting of a server and three client processes. Each client process will connect to the server over a socket connection and register a username at the server. The server should be able to handle all three clients simultaneously and display the names of the connected clients in real time.

Two or more clients may not use the same username simultaneously. Should the server detect a concurrent conflict in username, the clients connection should be rejected, and the clients user should be prompted to input a different name.

Every ten seconds, the server will randomly select a connected client and send that client an integer between 3 and 9. Upon receiving the integer, the client will pause (e.g., sleep or otherwise suspend) the thread managing the connection to the server for a period equaling the value received from the server, in seconds. The clients GUI will maintain a decrementing countdown timer indicating when the thread will resume, as well as a button to skip the wait and resume the threads operation immediately.

When the client thread is finished waiting, it will reply to the server with a message stating, Client <name> waited <#> seconds for server. The server will display this message on its GUI. This sequence will be repeated until the components are manually terminated by the user.

Client

Startup:

  1. Prompt the user to input a username.
  2. Connect to the server over a socket and register the username.
    1. When the client is connected, the user should be notified of the active connection.
    2. If the provided username is already in use, the client should disconnect and prompt the user to input another username.
  3. Proceed to accept commands received from the server until manually terminated by the user.

Receiving Pause Commands:

  1. The client will wait for Pause commands from the server.
  2. Upon reception of a Pause command, the client will suspend the thread managing the connection to the server for the indicated period.
  3. The client will display a counter on its GUI which decrements in accordance with the number of seconds remaining until the thread resumes.
  4. The thread will resume when either:
    1. The timer expires; or,
    2. The user manually resumes the thread by pressing a button on the GUI.
  5. Return to Receiving Pause Commands: Step 1 until manually killed by the user.

Server

The server should support three concurrently connected clients. The server should indicate which of those clients is presently connected on its GUI. The server will execute the following sequence of steps:

  1. Startup and listen for incoming connections.
  2. Print that a client has connected, and:
    1. If the clients username is available (e.g., not currently being used by another client), fork a thread to handle that client; or,
    2. If the username is in use, reject the connection from that client.
  3. Every ten seconds, the server should randomly select a connected client, then:
    1. Randomly choose and integer between 3 and 9; and,
    2. Send that integer to the selected client.
  4. The server will then wait for a reply from that client.
  5. Upon receiving a reply from a client, the server will print the reply to its GUI.
  6. Return to Step 1 until manually killed by the user.

Notes:

  • All three clients and the server may run on the same machine.
  • The server must correctly handle an unexpected client disconnection without crashing.
  • When a client disconnects from the server, the server GUI must indicate this to the user in real time.
  • The program must operate independently of a browser.

Citations:

You may use open source code found on the Internet in your program. When citing this code:

A full list of your source URLs should be included in your writeup file. Including generic citations (for instance, simple listing StackOverlow.com without additional details) will result in a ten (10) point deduction in your lab grade, per instance.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSE5306 Lab1- Client server architecture
$25