GIAC Python Coder (GPYC) — Question 20
A connection between a python raw socket server and a netcat client is being made over port 1100 on the same computer. The last command in the Python terminal is:
>>> connection,remoteip=pyserver.accept()
In the netcat terminal the following 2 lines were typed:
# nc 127.0.0.1 1100 This is a test
What needs to be typed in the python terminal to display the input from the netcat session?
Answer options
- A. Nothing, as the connection is complete
- B. connection.recv(1024)
- C. print(remoteip)
- D. Nothing, port 1100 is too low to bind the python server to
Correct answer: D
Explanation
The correct answer is D because port 1100 is not too low for binding, which means the server can accept connections on this port. Option A is incorrect because the connection is not complete; data needs to be received. Options B and C do not address the question as they do not relate to the binding issue.