Results 1 to 3 of 3

Thread: Port traffic help...

  1. #1
    Junior Member
    Join Date
    Aug 2002
    Posts
    9

    Port traffic help...

    Hey guys, this is probably a really stupid question... but, I need some help.

    I know, that when I go to a website, I am sending packets to port 80, their webserver. I know that when I go to an smtp server, I am sending packets to port 25.

    But, when I send packets to a web server on port 80, am I receiving packets on port 80? And when I send packets to port 25, am I receiving packets on 25?

    When I run netstat, I see that when I connect to a web server, traffic comes from port 80, and to a port like 3701.

    I'm juuuuust getting into programming, and I was thinking about writing a very simple tcp/ip program, however, I don't know what port I should be listening to when I'm receiving packets.

    I hope I made sence!

    -Drawenai

  2. #2
    Jaded Network Admin nebulus200's Avatar
    Join Date
    Jun 2002
    Posts
    1,356
    When you read about connecting to servers and servers running on well known ports, those are destination ports. If you look at the header for tcp, you will see that there is both a source port and a destination port (these services that you mentioned are using TCP (transport control protocol)). Usually, whenever a client (that is what makes the connection to a server, think of your web browser or email client) makes a connection to a server, it choses its own local ephemeral (aka non-well known, aka non-reserved, which is any port > 1023, but more typically in the 30000-65535 range) as the source port and the destination port of whatever service you are connecting to...

    A good tutorial on TCP/IP with connection establishment would probably be a good thing to read if you want to get into the nitty gritty...

    Here is the actual paper on the standard for tcp.

    http://www.ietf.org/rfc/rfc0793.txt

    /nebulus
    There is only one constant, one universal, it is the only real truth: causality. Action. Reaction. Cause and effect...There is no escape from it, we are forever slaves to it. Our only hope, our only peace is to understand it, to understand the 'why'. 'Why' is what separates us from them, you from me. 'Why' is the only real social power, without it you are powerless.

    (Merovingian - Matrix Reloaded)

  3. #3
    Senior Member
    Join Date
    Dec 2001
    Posts
    119
    Yep, nebulus pretty much summed it up. Just because your destination port is 80, by no means, means the source port is 80. Usually your application will dynamically decide which port to use, and then it is the transport protocol's job to get port information across to the server.

Posting Permissions

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