Networking Forums

Networking Forums > Computer Networking > Linux Networking > Sockets, port and loop-back ?

Reply
Thread Tools Display Modes

Sockets, port and loop-back ?

 
 
not@top-post
Guest
Posts: n/a

 
      01-04-2004, 04:22 PM
After reading Tannenbaum's 'Network' book, I had the illusion
that I understood some thing about networks !

Apparently not ?

Q1. Is it correct that 'ports' are sub-addresses of URLs;
so that http://<someID> will address the default port for http
at the IP of <someID>, and http://<someID>:<not default number>
will address the <not default number> port at the IP of <someID> ?

Q2. does the client insert the port number when the request is made ?

Q3 at which ISO level/layer is the port number inserted ?

Q4. Do servers have pysically different ports for eg. http & ftp, or
is it possibly the same physical [and some higher levels], just
behaving differently when it's talking http or ftp ?

Q5. At what level are sockets ?

Q6. Are they also just 'abstract connections', time-sharing
and being socketX [when the data goes-to/comes-from X's
buffers] but latter serving as socketY ?

Q7. How does [or not] 'loopback' fit in with all this ?

Thanks for any answers.

== Chris Glur. easlab AT absamail . co . za


 
Reply With Quote
 
 
 
 
P.T. Breuer
Guest
Posts: n/a

 
      01-04-2004, 05:00 PM
not@top-post wrote:
> Q1. Is it correct that 'ports' are sub-addresses of URLs;


No. But URLs allow you to specify the port as well as the IP address
(the standard port is given by the protocol identifier at the
front).

> so that http://<someID> will address the default port for http


Yes - the standard port.

> at the IP of <someID>, and http://<someID>:<not default number>
> will address the <not default number> port at the IP of <someID> ?


Yes.

> Q2. does the client insert the port number when the request is made ?


Yes.

> Q3 at which ISO level/layer is the port number inserted ?


Application. You know that.

> Q4. Do servers have pysically different ports for eg. http & ftp, or


No. They are virtually different. I.e. different numbers. Look them up.

> is it possibly the same physical [and some higher levels], just
> behaving differently when it's talking http or ftp ?


It's always the same physical thing.

> Q5. At what level are sockets ?


?? It's not an iso thing, is it? Dunno. Connection, I suppose.

> Q6. Are they also just 'abstract connections', time-sharing


They represent the other side to the operating system and applications.

> and being socketX [when the data goes-to/comes-from X's
> buffers] but latter serving as socketY ?


They don't exist. And a socket is always a socket. You can bind it to
different ip addresses and ports, however.

> Q7. How does [or not] 'loopback' fit in with all this ?


Loopback what? You mean the loopback network interface? It's just a
loopback.

> Thanks for any answers.


My pleasure.

Peter
 
Reply With Quote
 
Leon.
Guest
Posts: n/a

 
      01-04-2004, 07:32 PM
So after reading the text book for the course, instead of going to (or
paying attention in) classes, you found that you have no idea...

> > Q1. Is it correct that 'ports' are sub-addresses of URLs;


> No. But URLs allow you to specify the port as well as the IP address
> (the standard port is given by the protocol identifier at the
> front).



The Port in the URL is more of an override

protocol://hostname/directory...ort


>
> > so that http://<someID> will address the default port for http

>
> Yes - the standard port.





>
> > at the IP of <someID>, and http://<someID>:<not default number>
> > will address the <not default number> port at the IP of <someID> ?

>
> Yes.


yes, it overrides the standard / default port for that protocol.


> > Q2. does the client insert the port number when the request is made ?

>
> Yes.



>
> > Q3 at which ISO level/layer is the port number inserted ?

>
> Application. You know that.




>
> > Q4. Do servers have pysically different ports for eg. http & ftp, or

>
> No. They are virtually different. I.e. different numbers. Look them up.



if we ignore the word 'physical'....

Yes the servers live on different ports.

ftp on port 20, http on port 80.

Actually its one process on the port. that process is 'listening' .. it
will fork when it gets a connection, so that it can continue to listen, the
child then starts talking protocol down the tcp/ip session...



Actually port numbers exist in every packet of the TCP/IP session.

When a socket is engaged with a tcp/ip session , that socket is identified
by
Local IP address, Local Port, remote Ip address ,remote port.

Incoming tcp/ip packets are identifed by these values, and then the packet
is given to the socket that matches.

When the socket produces a tcp/ip packet, the packet is labelled with these
values, but in reverse, ready for the other end's socket to receive it.


> > is it possibly the same physical [and some higher levels], just
> > behaving differently when it's talking http or ftp ?


well if you tell your ftp server to run on port 80, its still going to talk
ftp,
and web browers wont work with http://youcomputer:80

you would need to use ftp://yourcomputer:80



> > Q5. At what level are sockets ?

>
> ?? It's not an iso thing, is it? Dunno. Connection, I suppose.



Well its how its implemented, not to do with the levels.




>
> > Q7. How does [or not] 'loopback' fit in with all this ?

>
> Loopback what? You mean the loopback network interface? It's just a
> loopback.


Loopback is so that there is an interface that you can use if you want to
run test network applications on the one computer , instead of using two
computers, or its actually useful like that, eg for X windows.


 
Reply With Quote
 
Neil Horman
Guest
Posts: n/a

 
      01-05-2004, 12:35 PM
not@top-post wrote:
> After reading Tannenbaum's 'Network' book, I had the illusion
> that I understood some thing about networks !
>
> Apparently not ?
>
> Q1. Is it correct that 'ports' are sub-addresses of URLs;
> so that http://<someID> will address the default port for http
> at the IP of <someID>, and http://<someID>:<not default number>
> will address the <not default number> port at the IP of <someID> ?
>

No. Ports are a concept which relate to the protocol you are
communicating with. In the most common case of TCP/IP, ports allow for
the identification of logical endpoints on a physical system (which has
a unique IP address on a network). The concept of ports in TCP/IP
allows for applicaitons to use multiple sockets on a system. In short,
the tuple <ip address, port> uniquely identifies a TCP/IP network
connection between two systems. As an example, a web server and an FTP
server can both service client connections on the same system, because
each service listens for connections on a different port.

> Q2. does the client insert the port number when the request is made ?
>

Yes. the following man pages will give you details:
connect
bind(2)
listen
ip(7)
sendmsg

> Q3 at which ISO level/layer is the port number inserted ?
>

the Network layer I imagine, as ports are a protocol level addressing
mechanism.

> Q4. Do servers have pysically different ports for eg. http & ftp, or
> is it possibly the same physical [and some higher levels], just
> behaving differently when it's talking http or ftp ?
>

What do you mean? Applications listen on different ports (at least in
tcp/ip) so that they don't have to recieve and interpret each others
data traffic. Its a logical construct though, so the use of the term
physical here is incorrect.

> Q5. At what level are sockets ?
>

Sockets are an API, not really a layer in the OSI model. If I had to
pick, I'd say they were the application layer interface to the network,
as thats where the API is used.

> Q6. Are they also just 'abstract connections', time-sharing
> and being socketX [when the data goes-to/comes-from X's
> buffers] but latter serving as socketY ?
>

This is a non-sensical question. what are you asking?

> Q7. How does [or not] 'loopback' fit in with all this ?
>

'loopback' is the mechansim by which a single system can serve as both
endpoints in a network connection. It allows port x on a system to talk
to port y on the same system. Commoly, the loopback mechansim is
implemented as a network interface for which the driver simply recieves
every frame which it is requested to transmit.

Neil

--
Neil Horman
Red Hat, Inc., http://people.redhat.com/nhorman
gpg keyid: 1024D / 0x92A74FA1, http://www.keyserver.net

 
Reply With Quote
 
jack
Guest
Posts: n/a

 
      01-05-2004, 01:24 PM
Neil Horman wrote:

>> Q5. At what level are sockets ?


>> Q6. Are they also just 'abstract connections', time-sharing
>> and being socketX [when the data goes-to/comes-from X's
>> buffers] but latter serving as socketY ?


You should try not to look at things too "physically"...:
As others already explained, a socket is just a word for the
mechanism that You use to allow applications to use the "networking
facilities" of Your OS. So eventually, if You try to follow any given
TCP/IP packet from any server application to the requesting client
application and back, You will not see any "socket" there.

As a consequence, You will not re-use any socket, but "create" one when-
ever You need it and "destroy" it when You're done with it. In that
respect, and in combination with Your physical perception of this
mechanism, the term "socket" is misleading You.

Open Your box: You'll find that there are no "sockets"...

So, "socket" summarizes the work needed to make one specific appli-
cation talk (or listen) over the network.

>> Q7. How does [or not] 'loopback' fit in with all this ?


As Neil said, it may be desirable to have both server and client
applications on the same box, like in "telnet localhost" and the like.
X was a very good example: Avoiding to get too far off Your original
question, all communication between X clients and X servers occurs in
a way that works like a "normal" connection over the network. If You
don't have any network card installed ("standalone"), "loopback" pro-
vides You with some sort of pseudo network connection and interface
where both ends are local.

If You got the point of that last paragraph, You will see why X is an
excellent example for this: You can have an X-Terminal which runs only
an X server, and run applications (X clients) on a faster machine that
will only send their output to that terminal and read that terminals'
mouse and keyboard for input. This would be a "real" network connection
between X server and X client. -- Or, You can have both on the same
machine. The communication between X server and X client will be _ex-
actly_ the same, but instead of using ethN and a remote endpoint, it
will go through "lo" where, again, both ends are local.


Hope this cleared Neils excellent answer a bit for You, Jack.

--
----------------------------------------------------------------------
My personal reading of the string "MicroSoft" expands to "NanoWeak"...

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
loop back address and own IP address asit Linux Networking 1 08-18-2008 06:43 AM
Loop back address aarklon@gmail.com Linux Networking 1 08-04-2008 07:30 AM
How many sockets when using 4 port router modem? Geoff Mills Home Networking 8 11-08-2006 01:24 PM
Novice questions about WAN port on the back of my linksys router Ou Phrontis Linux Networking 2 10-05-2005 01:44 AM
loop back adapter for Windows 98 Fred Davis Windows Networking 0 08-08-2003 02:43 PM



1 2 3 4 5 6 7 8 9 10 11