3 edited tags
| link
2 deleted 241 characters in body; edited title
source | link

how How does the server comes to know about thefind out what client port to whom server needs to send datato?

As per my understanding below are the following steps when a client makes a 
connection request.
1.Server will be binded to a particular port number.Always port number is 
binded only to the process which listens.Since only server is listening for
incoming connections,we dont have bind in client side.
2.Server will be keep on listeninig on that port number.
3.Client will send connect() request.
4.Server will accept the request using accept().As soon as the server 
accepts the client request,kernel allocates a random port number for the 
server for further send and receive().Because same port number of the 
server cant be used for sending as well as listening.Because the previous
port need to listen for other incoming connections too.But from which 
function() server comes to know about the client port ?I know that client 
will send TCP segments with source port and destination port.So server will
use the source  port of that segment as its destination port.But program 
wise if we are thinking then from which function is the server fetching the
client port details.Is it accept() ?If server needs to send data to 
client,it need to know the port number of the client right?Any body pls 
help me on understanding this concept.

As I understand it this is what happens when a client makes a connection request:

  1. The server will be bound to a particular port number. The port number is always bound to a listening process. Since only the server is listening for incoming connections, we don't need to bind on the client side
  2. The server will keep on listeninig on that port number.
  3. The client will send a connect() request.
  4. The server will accept the request using accept(). As soon as the server accepts the client request, the kernel allocates a random port number for the server for further send() and receive(), since the same port number on the server can't be used for sending as well as listening, and the previous port is still listening for new connections

Given all that, how does the server find out what port the client is receiving on? I know the client will send TCP segments with a source port and destination port, so the server will use the source port of that segment as its destination port, but what function does the server call to find out about that port? Is it accept()?

how the server comes to know about the client port to whom server needs to send data?

As per my understanding below are the following steps when a client makes a 
connection request.
1.Server will be binded to a particular port number.Always port number is 
binded only to the process which listens.Since only server is listening for
incoming connections,we dont have bind in client side.
2.Server will be keep on listeninig on that port number.
3.Client will send connect() request.
4.Server will accept the request using accept().As soon as the server 
accepts the client request,kernel allocates a random port number for the 
server for further send and receive().Because same port number of the 
server cant be used for sending as well as listening.Because the previous
port need to listen for other incoming connections too.But from which 
function() server comes to know about the client port ?I know that client 
will send TCP segments with source port and destination port.So server will
use the source  port of that segment as its destination port.But program 
wise if we are thinking then from which function is the server fetching the
client port details.Is it accept() ?If server needs to send data to 
client,it need to know the port number of the client right?Any body pls 
help me on understanding this concept.

How does the server find out what client port to send to?

As I understand it this is what happens when a client makes a connection request:

  1. The server will be bound to a particular port number. The port number is always bound to a listening process. Since only the server is listening for incoming connections, we don't need to bind on the client side
  2. The server will keep on listeninig on that port number.
  3. The client will send a connect() request.
  4. The server will accept the request using accept(). As soon as the server accepts the client request, the kernel allocates a random port number for the server for further send() and receive(), since the same port number on the server can't be used for sending as well as listening, and the previous port is still listening for new connections

Given all that, how does the server find out what port the client is receiving on? I know the client will send TCP segments with a source port and destination port, so the server will use the source port of that segment as its destination port, but what function does the server call to find out about that port? Is it accept()?

1
source | link

how the server comes to know about the client port to whom server needs to send data?

As per my understanding below are the following steps when a client makes a 
connection request.
1.Server will be binded to a particular port number.Always port number is 
binded only to the process which listens.Since only server is listening for
incoming connections,we dont have bind in client side.
2.Server will be keep on listeninig on that port number.
3.Client will send connect() request.
4.Server will accept the request using accept().As soon as the server 
accepts the client request,kernel allocates a random port number for the 
server for further send and receive().Because same port number of the 
server cant be used for sending as well as listening.Because the previous
port need to listen for other incoming connections too.But from which 
function() server comes to know about the client port ?I know that client 
will send TCP segments with source port and destination port.So server will
use the source  port of that segment as its destination port.But program 
wise if we are thinking then from which function is the server fetching the
client port details.Is it accept() ?If server needs to send data to 
client,it need to know the port number of the client right?Any body pls 
help me on understanding this concept.