Winsock, port numbers and XP

D

David Peters

I find that the more I try and read up on Winsock and port numbers
and XP the more I find I get either ultra-basic stuff or ultra-
advanced stuff.

Can someone help to set me back on the right track by answering
these questions:

(1) Does XP Pro use winsock?

(2) If so then does XP have to use use Winsock or is there an
viable alternative in XP?

(3) I know that http traffic goes through port 80. Does this
number '80' refer to the number of the port on my PC or the number
of the port on the web server?

(4) An IP address and a port number is often shown something like
this: xxx.xxx.xxx.xxx:nn (where nn is the port number)
By convention, if the xxx.xxx.xxx.xxx is my IP address then does
the the 'nn' refer to the port number on my machine or does it
refer to the port number that I am accessing on the server?

(5) What is the general idea of port numbers incrementing by one
as the exchange continues between my PC and a web server? I have
seen this in my firewall logs: port number 80 remains the same
but the other port number sometimes varies, often by going up one
integer at a time.
 
R

Ron Lowe

In-Line.....


David Peters said:
I find that the more I try and read up on Winsock and port numbers
and XP the more I find I get either ultra-basic stuff or ultra-
advanced stuff.

Can someone help to set me back on the right track by answering
these questions:

(1) Does XP Pro use winsock?
Yes.


(2) If so then does XP have to use use Winsock or is there an
viable alternative in XP?

Winsock provides a method for programmers to access the Operating System's
network stack. Unless you are writing network code, then you don't need to
consider this any further.

(3) I know that http traffic goes through port 80. Does this
number '80' refer to the number of the port on my PC or the number
of the port on the web server?

On the server.
(4) An IP address and a port number is often shown something like
this: xxx.xxx.xxx.xxx:nn (where nn is the port number)
By convention, if the xxx.xxx.xxx.xxx is my IP address then does
the the 'nn' refer to the port number on my machine or does it
refer to the port number that I am accessing on the server?

The :nn refers to a port number on the machine who's IP address is
xx.xx.xx.xx.
You need to understand how a TCP connection works:

A web browser on your PC will send a request FROM your PC's IP Address and a
Random Port Number ( typically >1024 ) TO the web server's IP address : Port
80. The packet will have the following data in it:

Source: YourIP:1025
Destination: WebServer:80

The web server will reply with data FROM it's port 80 TO your IP address, on
whatever port you used.

Source: WebServer:80
Destination: YourIP:1025

(5) What is the general idea of port numbers incrementing by one
as the exchange continues between my PC and a web server? I have
seen this in my firewall logs: port number 80 remains the same
but the other port number sometimes varies, often by going up one
integer at a time.

The port numbers will increment if your browser establishes new connections.
( eg you follow a link to a new page. ) The previous ports will be made
available again once the connection they were used for is torn down.

So if you open a new browser window, it will establish a new connection from
the next free port for example port 1026.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top