Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Please clarify what a port address is? I use specific port address for smtp and I see a different port address for my internet browsers. Is the port number I use for sending mail in my perl scripts dependent on the software application I am using?? For example if I use Cold Fusion to send mail I would use a Cold Fusion port number? But perl would use its own port number?

Replies are listed 'Best First'.
Re: Port number explanation
by arden (Curate) on Feb 06, 2004 at 16:22 UTC
    A port number is a way of identifying a service on a machine. There are default port numbers, like 25 for SMTP, 23 for Telnet, 22 for SSH, 80 for HTTP, 443 for SSL, etcetera, but they can be changed. Only services offering something on a network (even if it is itself) need port numbers, so perl in itself doesn't have a port number.

    One way to look at port address is this analogy: The IP# is the Zip/Postal code for your town, the port number is your house. I know, it's not the best analogy, but it works. . .

    Update: Fletch is correct, 443 is for HTTP over SSL.
        FTP uses 20 & 21, POP3 uses 110, DNS uses 53, finger uses 79, and my favorite, gopher, uses 70. For a listing of port assignments, look here.

      Technically 443 is for HTTP over SSL. SSL (or TLS) can be used to encrypt many different TCP protocols (IMAP, POP, SMTP, HTTP, Telnet, ...).</pedant>

Re: Port number expanation
by tcf22 (Priest) on Feb 06, 2004 at 16:24 UTC
    Off topic, but...

    No, programming languages don't have their own port numbers. Port numbers are for specific services. If you are sending mail through SMTP, then use the SMTP(25) port. If you are connecting to a HTTP server, then use the HTTP(80) port. I think you get the jist. They can be changed, but normally you want to stick with the standard.

    Port List

    - Tom