Hidden Socket Finder

I have a server running on Euclid.  It's running somewhere between port 40,000 and port 41,000.
It prints a secret message.
I also have a server running on port 40,900.  It prints a message about our vice president.
 
 
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
Notes:  Some people get annoyed when you port-scan them.  You can do it on Euclid, but don't do it to other people.

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.