Call a URL an EARL
“URL” stands for Uniform Resource Locator, and since I’m so lazy, I pronounce it as “Earl”. It saves you 7 syllables, and possible embarrassment if you accidentally said “uniform refund lecturer”. Also, being from the USA, when speaking, I would say “an EARL” rather than “a EARL” since EARL begins with a vowel. If I were going to actually say the letters separately, I would say ” a U R L”, instead of “an U R L”. If i am typing it in an email message, or, this post, for example, I would use “an URL”, while mentally hearing “an Earl”because I type pretty much like I speak.
We coders and/or network managers use multiple protocols to do our jobs. There are web servers, ftp servers, mail servers, and database servers. You can at least test them to see if they’re up by using telnet, and knowing a few commands can help you test functionality.
Web servers default to use port 80. They can be set to listen to other ports, but 80 is the default. If you set one up to run on port 8000, you would have to use http://www.example.com:8000 to get there, AND the scheme HTTP:// is required, because browsers can handle multiple schemes, which designate the protocol. Think of a protocol as a dialect of English. Using anything other than the default port is required to let the browser know to use the http protocol.
So, let’s test the web server to see it it’s up. Make sure that you’re at the Linux or Windows command line:
telnet www.microsoft.com 80
If it’s not able to connect, you’ll get an error message, but in this case, we all know that Microsoft should always be up (?). You should see a message saying that it is connecting, and then the screen will go blank. Now test the functionality of it:
Press ENTER twice. The first ENTER ends the GET command. The second ENTER tells the server that you are through with the commands. You should see some html there, like at least a <html><head><title>Microsoft Corporation</title> all the way down to the </html> tag.
The web server is up and functioning. Once you receive the HTML, it will close the connection, because HTTP is a stateless protocol. You make a connection, make a request, get the results, and the connection is closed.
FTP is an entirely different protocol, and uses two different ports. The default ports are 21 for the commands, and 20 to transfer the data. We’ll only test the command port here.
telnet www.microsoft.com 21
Telnet to ftp.microsoft.com on port 21, and type “HELP” and hit enter. You’ll see a listing of all valid commands that their server supports.
220 Microsoft FTP Service
214-The following commands are recognized (* ==>’s unimplemented).
So, the ftp server is up and functional. Whether or not you are authorized to get or put files is a matter of authentication.
This is Simple Mail Transport Protocol, and is only used for sending email. The default port is 25. Talking to your mail server is just as easy as HTTP and FTP. Telnet to mysmtpserver.com on port 25. You should see a 220 greeting message like this (all lines with a numeric code at the beginning of the line came from the server):
220 Welcome Road Runner. WARNING: *** FOR AUTHORIZED USE ONLY! ***
250-hrndva-omtalb.mail.rr.com says EHLO to 184.108.40.206:56199
To send a message, use the commands shown below. :
250 MAIL FROM accepted
250 RCPT TO accepted
354 continue. finished with “\r\n.\r\n”
this is a test message
hit return, then a period, then a return to end the message, as you see above (\r\n.\r\n)
I can hit enter as many times as I want to
but enter, then . then enter, and I’m done.
In this case, my server refused the message, because I didn’t actually log in using my username/password. We wouldn’t want to let everybody and their chihuahua send SPAM via this server, correct?
This is Post Office Protocol, and is only used for receiving email. The default port is 110. Talking to your POP server is just as easy as talking to your SMTP server, except the protocol (commands) are different. Telnet to mypopserver.com on port 110. You should see a 220 greeting message like this (all lines with a numeric code at the beginning of the line came from the server):
We can do the same with databases, but the actual commands used are pretty complex, so I won’t go into that. The default port for Microsoft SQL server is 1433, and for MySQL it’s 3306.
The server that I have MSSQL Server on won’t come up. It worked the last time I turned it on, but this time it didn’t. That’s when things usually break, folks – when you turn them on.
OK, for MySQL:
telnet 127.0.0.1 3306
You should get a bit of garbage, but you should at least see the version of MySQL you’re using. I get 5.5.16, which is correct.
Most of us in the business already know this stuff, but for the others…
“So what are all of these port numbers” you ask? Think of them as doors into your house (server). Webb (the web server, and my father’s first name) only answers the front door, one request, (Can Billy come out to play?), answers it (No, he’s got the chicken pox), and promptly closes the door (as we saw above when testing – the connection is immediately closed).
Freddie (FTP) only listens to the back door, waits for a request, and (hopefully) sends you a file. He doesn’t close the door like Harold does, because you might want to ask for another file.
Sammy (SMTP mail server) only answers the side door. If you show him your identification, he will then accept a message from you to be sent to someone else. Like Freddie, he leaves the door open, in case you want to send another message.
To repeat: Web servers default to port 80. FTP servers default to port 21. SMTP servers default to port 25. A server can have multiple web servers, web sites, ftp services, and smtp servers; all you have to do is use different port numbers on each service. Universities used to use multiple ports on their one web server to differentiate between the different departments. They may still do that; I’m not in college any more.
Keep in mind that if you add too many doors, the house (server) will eventually fall down.