Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ASSIGNMENT
Internal Components
Adhyan Mall
RA1811003010051
CSE A1
Q1)Write a client application that executes an infinite loop that does the
following: (a) prompts the user for a number, (b) sends that value to the
server, (c) receives the number, and (d ) displays the new number. Also
write a server that executes an infinite loop whose body accepts a client
connection, reads a number from the client, computes its square root,
and writes the result to the client.
Server_program
Output
Client_program
Output
Q2) Suppose, we want to maintain a bank account of customers.
Several transactions, such as deposite some amount to an account and
withdraw some amount from an account etc. are possible. Now, for a
given account, if two or more transactions come simultaneously then
only one transaction should be allowed at a time instead of
simultaneous transaction processing so that data inconsistency will
never occur. So, what we need is to synchronize the transaction.
Server_program
Output
Client_program
Output
Q3)Write a program WordCount that counts the words in one or more
files. Start a new thread for each file. For example, if you call
WordCount for report.txt address.txt Homework.java then the program
might print
address.txt: 1052
Homework.java: 445
report.txt: 2099
Server_program
Output
Client_program
Output
Q4)Create a simple TCP client server application where client request a
meaning for a word. inturn server replies the meaning of the word for
the client. Create a dictionary in server which stores the word and
meaning.
Server_program
Output
Client_program
Output
Q5)Create a Simple UDP client server application where client request a
file and server searches the directory for the file and if the file presents
return the contents of the file as line, word , and character count to the
client
Server_program
Output
Client_program
Output