C language (Linux environment

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In this project, you are required to do socket programming in C language (Linux environment) to implement a pair of client and server that can achieve simple password verification to indicate the current market value of the stock. Your client will send a pair of username and password to your server and your server will verify whether the pair of username and password is legitimate or not for retrieving the stock value. Assume the only legitimate pairs of usernames and passwords that will be accepted by your server are as follows.


Username      Password         StockValue
lcid                    welpa23e          13.93
mrvl                     ghqwo31a       41.23
snap                    tyjli14d             10.21
cl1                        rjwqe83f           85.09
bro                        gnmds28z         56.43
cvs                        rhktl87c             91.34

StockFile.txt

Specifically, your client and server programs entail to achieve the following requirements:
1. Your client program needs to take two arguments that specify the name of server and the port that it is trying to connect to. Your program for server needs to take an argument that specifies the port that it is listening to. You can use (5000+last 4 digits of your student-id number) as a port number. 

2. The server program will start first and keep listening to the specified port. Your client will connect to the port that your server is listening to, and a socket between your client and server is constructed.


3. Your client program will first prompt a welcome message that asks the user to enter a username using the keyboard. This username will then be sent to the server. Then, your server, after receiving the username from your client, will send an acknowledgment message to the client.


4. Your client, after receiving the acknowledgment message from your server, will prompt a message that asks the user to enter the corresponding password. This password will then be sent to the server. Then, your server, after receiving the password from your client, will verify the received pair of username and password against the list of legitimate pairs. If the result is positive, the server will send a success message along with the current market value of the stock to the client. If the result is negative, the server will send a failure message to the client.


5. Your client, after receiving the result message, will print out the result and close the socket. Your server will close the socket following the client, and keep listening for the next client request.

6. Your server will close the socket after waiting for the username or the password for 30 seconds.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 12 images

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education