Closed Thread
Results 1 to 3 of 3

Thread: Why Port 80 ??

  1. #1
    bodhi2016 is offline Newbie
    Join Date
    Jan 2008
    Posts
    29
    Rep Power
    0

    Smile Why Port 80 ??

    Well in most of the tutorial of winsock programming they are usung the port 80 in the client as well as the server software.
    Like
    Code:
    addess.sin_port=htons(80);//where address is a name for my sockaddr_in structure
    Why cant we use any other port .
    --------------------------------------------------------------------------------
    And another thing is that when i am writing
    Code:
    addess.sin_port=htons(80) //converting port 80 to network byte order
    addess.sin_addr.s_addr=inet_addr( ("127.0.0.1");//converting the ip 127.0.0.1to network byte order
    in the client software I am connecting through port 80 with the computer whose ip address is 127.0.0.1(this is an internal ip address as methodz explained earlier)
    Similarly when i am writing
    Code:
    addess.sin_port=htons(80) //converting port 80 to network byte order
    addess.sin_addr.s_addr=INADDR_ANY;
    in the server software i am looking for a connection on port 80 from any ip address
    AM I RIGHT in my conclusion of the above to code snippet??
    Last edited by Jordan; 06-19-2008 at 01:22 PM.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    May 2008
    Posts
    2,126
    Blog Entries
    1
    Rep Power
    33

    Re: Why Port 80 ??

    Port 80 is actually the port most commonly used for web servers (the http port). I really don't know why the tutorials are recommending you to do that as it can cause clashes, probably just out of simplicity. You can however use any port you want to use, and it is actually best to use one out of the 1 to 1023 range, and out of the 1023 to 4---- (couldn't remember what this number was exactly) range, as those are the assigned ranges and company ranges. Above that is basically the wild wild west of port numbers and free to be used by anyone.

    You are correct in your conclusion, however try to avoid using caps as it looks like you are yelling and telling everyone that your post is more urgent than everyone else.

    INADDR_ANY -> signifies that you will be accepting connections from any address.

  4. #3
    dcs
    dcs is offline Guru
    Join Date
    Mar 2008
    Posts
    775
    Rep Power
    23

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PHP Port Scanner
    By TkTech in forum Classes and Code Snippets
    Replies: 41
    Last Post: 02-16-2010, 08:58 AM
  2. Com port
    By RandomCode in forum C and C++
    Replies: 8
    Last Post: 01-30-2010, 12:47 PM
  3. CLI Port Sniffer
    By John in forum PHP Tutorials
    Replies: 5
    Last Post: 09-23-2008, 09:58 PM
  4. Port Forwarding in SSH
    By morefood2001 in forum Linux Applications
    Replies: 5
    Last Post: 05-21-2008, 05:16 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts