-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.py
64 lines (51 loc) · 2.28 KB
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import socket
host = '127.0.0.1'
port = 5000
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientSocket.connect((host, port))
try:
while True: # Loop until the user presses 'X'
print(clientSocket.recv(3000).decode())
clientSocket.send('Working!'.encode())
while True:
print("""
Enter the Question Number to get answer for that question!
1. What is the total number of CS credits required to complete the 4-year BSc Hons degree in CS?
2. Could you provide a breakdown of CS credits ?
3. What are the core courses ?
4. How many credits are allocated for non-academic activities?
5. What courses are suggested for the 5th semester?
6. How many credits are allocated for internships?
7. What is the structure of the academic credits, including FC credits, core CS credits, project credits, and elective credits?
8. Can you provide a sample course path for a student starting in the 1st semester and completing the 4-year BSc Hons degree in CS?
9. What courses are recommended for students interested in specializing in Information Security?
10. What are open credits?
11. Request prerequisites for a course.
Or Press X to exit!
What would you like to view? (1-11/X): """, end='')
choice = input()
clientSocket.send(choice.encode())
print()
if choice == 'X':
break
elif choice == '11':
print("Here are all the courses for which prerequisite information is available:")
course_names = clientSocket.recv(3000).decode()
print(course_names)
print("Enter the course name for which you want to know the prerequisites: ", end='')
course_name = input()
clientSocket.send(course_name.encode())
response = clientSocket.recv(3000).decode()
print()
print(response)
elif choice in ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10'):
response = clientSocket.recv(3000).decode()
print(response)
else:
response = clientSocket.recv(3000).decode()
print(response)
if choice == 'X':
break
except OSError:
print("Connection closed")
clientSocket.close()