Points | Task |
2 | You can open a socket to a given port number |
2 | You can find the secret port number |
2 | You can read the secret message |
2 | You check for errors on ALL appropriate system calls |
-2 | You never check for errors correctly |
2 | You show it to me by Tuesday the 25th |
-2 | You show it to me after Thursday the 27th |
There is a limit to the number of open sockets you can have. If you keep opening sockets, you will exceed this limit. Instead, do this ...
for(port = 40000; i < 41001; i++)
socket = make_a_socket(port, "euclid")
if (socket == 1)
print YEA
else
print NOPE
close(socket)
<---- this is important
You do NOT have to check for errors on close.
If you are testing a portnumber that has no server, you will get an
error. That doesn't mean your program fails, it
means that your program hasn't found it yet.