Using client-server socket programming, implement a multi-threaded server that returns to the client the synonym of a word as stored in a dictionary. The client should prompt the user for a word, reads the word from the screen and sends it to the server and waits for response from the server. Once the client gets the synonym of the word, it should print the word and its synonym on the screen and prompt for another word. This should continue until the user enters the characters @ to quit. Example: >>> python TCPClient.py Input a word: weak weak ==> frail Input a word: fair fair ==> just Input a word: @ Notes: 1) A file that contains some words and their synonyms is provided 2) In the server code, read the file to a global python dictionary object engDict = {} # empty dictionary object with open('dictionary.txt') as f: # open the file for line in f: tok = line.split() engDict[tok[0]] = tok[1] print(engDict) 3) Here is a Skelton of the server [some code here ] class ServeClient(threading.Thread): def __init__(self, conn, (ip, port)): threading.Thread.__init__(self) self.ip = ip [add code here ] def run (self) : while True: data = [ add code here ] if cmd == '@': [add code here ] if engDict.has_key(cmd): [add code here ] else: [add code here ] [add code here ] with open('dictionary.txt') as f: [add code here ] serverName = socket.gethostname() serverPort = 12345 serverSocket = [add code here] serverSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) [add code here ] print 'Server ready to recieve ' threads = [] while True: [ add code here ] newThread = ServeClient(connectionSocket, addr) [ add code here ] for t in threads: t.join() What to turn in Turn in by the due date the two files client.py and server.p

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Using client-server socket programming, implement a multi-threaded server that returns to the client the synonym of a word as stored in a dictionary. The client should prompt the user for a word, reads the word from the screen and sends it to the server and waits for response from the server. Once the client gets the synonym of the word, it should print the word and its synonym on the screen and prompt for another word. This should continue until the user enters the characters @ to quit. Example: >>> python TCPClient.py Input a word: weak weak ==> frail Input a word: fair fair ==> just Input a word: @ Notes: 1) A file that contains some words and their synonyms is provided 2) In the server code, read the file to a global python dictionary object engDict = {} # empty dictionary object with open('dictionary.txt') as f: # open the file for line in f: tok = line.split() engDict[tok[0]] = tok[1] print(engDict) 3) Here is a Skelton of the server [some code here ] class ServeClient(threading.Thread): def __init__(self, conn, (ip, port)): threading.Thread.__init__(self) self.ip = ip [add code here ] def run (self) : while True: data = [ add code here ]
if cmd == '@': [add code here ] if engDict.has_key(cmd): [add code here ] else: [add code here ] [add code here ] with open('dictionary.txt') as f: [add code here ] serverName = socket.gethostname() serverPort = 12345 serverSocket = [add code here] serverSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) [add code here ] print 'Server ready to recieve ' threads = [] while True: [ add code here ] newThread = ServeClient(connectionSocket, addr) [ add code here ] for t in threads: t.join()


What to turn in
Turn in by the due date the two files client.py and server.py

A assignment-1-2.pdf - Adobe Acrobat Reader DC (32-bit)
File Edit View Sign Window Help
Home
Tools
assignment-1-2.pdf x
Sign In
1 / 2
75.5%
Search 'Merge PDF'
Computer Network
Programming Assignment 1
Export PDF
Using client-server socket programming, implement a multi-threaded server that
returns to the client the synonym of a word as stored in a dictionary. The client
should prompt the user for a word, reads the word from the screen and sends it to
the server and waits for response from the server. Once the client gets the synonym
Adobe Export PDF
Convert PDF Files to Word
or Excel Online
of the word, it should print the word and its synonym on the screen and prompt for
another word. This should continue until the user enters the characters @ to quit.
Select PDF File
assignment-1-2.pdf
Example:
Convert to
>>> python TCPClient.py
Input a word: weak
weak ==> frail
Input a word: fair
fair ==> just
Input a word: @
Microsoft Word (*.docx)
Document Language:
English (U.S.) Change
Notes:
1) A file that contains some words and their synonyms is provided
Convert
2) In the server code, read the file to a global python dictionary object
# empty dictionary object
engDict = {}
with open('dictionary.txt') as f:
for line in f:
# open the file
tok = line.split()
engDict[tok[@]] = tok[1]
print(engDict)
Edit PDF
Create PDF
3) Here is a Skelton of the server
Comment
[some code here ]
class serveclient(threading. Thread):
def
_init_(self, conn, (ip, port)):
threading. Thread._init_(self)
self.ip = ip
[add code here ]
Combine Files
EI Organize Pages
def run (self) :
while True:
data =
[ add code here ]
Convert, edit and e-sign PDF
forms & agreements
Free 7-Day Trial
12:36 PM
^모 d) ENG
4/24/2021
近
Transcribed Image Text:A assignment-1-2.pdf - Adobe Acrobat Reader DC (32-bit) File Edit View Sign Window Help Home Tools assignment-1-2.pdf x Sign In 1 / 2 75.5% Search 'Merge PDF' Computer Network Programming Assignment 1 Export PDF Using client-server socket programming, implement a multi-threaded server that returns to the client the synonym of a word as stored in a dictionary. The client should prompt the user for a word, reads the word from the screen and sends it to the server and waits for response from the server. Once the client gets the synonym Adobe Export PDF Convert PDF Files to Word or Excel Online of the word, it should print the word and its synonym on the screen and prompt for another word. This should continue until the user enters the characters @ to quit. Select PDF File assignment-1-2.pdf Example: Convert to >>> python TCPClient.py Input a word: weak weak ==> frail Input a word: fair fair ==> just Input a word: @ Microsoft Word (*.docx) Document Language: English (U.S.) Change Notes: 1) A file that contains some words and their synonyms is provided Convert 2) In the server code, read the file to a global python dictionary object # empty dictionary object engDict = {} with open('dictionary.txt') as f: for line in f: # open the file tok = line.split() engDict[tok[@]] = tok[1] print(engDict) Edit PDF Create PDF 3) Here is a Skelton of the server Comment [some code here ] class serveclient(threading. Thread): def _init_(self, conn, (ip, port)): threading. Thread._init_(self) self.ip = ip [add code here ] Combine Files EI Organize Pages def run (self) : while True: data = [ add code here ] Convert, edit and e-sign PDF forms & agreements Free 7-Day Trial 12:36 PM ^모 d) ENG 4/24/2021 近
A assignment-1-2.pdf - Adobe Acrobat Reader DC (32-bit)
File Edit View Sign Window Help
Home
Tools
assignment-1-2.pdf x
Sign In
2 / 2
75.5%
Search 'Merge PDF'
Export PDF
Adobe Export PDF
if cmd == '@' :
[add code here ]
Convert PDF Files to Word
if engDict.has_key (cmd):
[add code here ]
else:
or Excel Online
Select PDF File
[add code here ]
[add code here ]
assignment-1-2.pdf
with open('dictionary.txt') as f:
[add code here ]
Convert to
Microsoft Word (*.docx)
serverName = socket.gethostname ()
serverPort = 12345
Document Language:
serversocket = [add code here]
serversocket.setsockopt(socket.SOL_SOCKET, socket.so_REUSEADDR, 1)
English (U.S.) Change
[add code here ]
print 'Server ready to recieve
threads = [)
Convert
while True:
[ add code here ]
newThread = Serveclient(connectionSocket, addr)
[ add code here ]
for t in threads:
t.join()
Edit PDF
Create PDF
What to turn in
Turn in by the due date the two files client.py and server.py|
Comment
Combine Files
EI Organize Pages
Convert, edit and e-sign PDF
forms & agreements
Free 7-Day Trial
12:36 PM
^모 4) ENG
4/24/2021
近
Transcribed Image Text:A assignment-1-2.pdf - Adobe Acrobat Reader DC (32-bit) File Edit View Sign Window Help Home Tools assignment-1-2.pdf x Sign In 2 / 2 75.5% Search 'Merge PDF' Export PDF Adobe Export PDF if cmd == '@' : [add code here ] Convert PDF Files to Word if engDict.has_key (cmd): [add code here ] else: or Excel Online Select PDF File [add code here ] [add code here ] assignment-1-2.pdf with open('dictionary.txt') as f: [add code here ] Convert to Microsoft Word (*.docx) serverName = socket.gethostname () serverPort = 12345 Document Language: serversocket = [add code here] serversocket.setsockopt(socket.SOL_SOCKET, socket.so_REUSEADDR, 1) English (U.S.) Change [add code here ] print 'Server ready to recieve threads = [) Convert while True: [ add code here ] newThread = Serveclient(connectionSocket, addr) [ add code here ] for t in threads: t.join() Edit PDF Create PDF What to turn in Turn in by the due date the two files client.py and server.py| Comment Combine Files EI Organize Pages Convert, edit and e-sign PDF forms & agreements Free 7-Day Trial 12:36 PM ^모 4) ENG 4/24/2021 近
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY