Click here to Skip to main content
15,885,925 members

Comments by SubratSarkar (Top 2 by date)

SubratSarkar 31-Aug-12 3:00am View    
Thanks for reply. I got your point but my concern with statement as you mentioned here -
Quote:
The address/port pair in the incoming packet identifies a machine(address) and a socket object inside (port) the networking part of the OS. Any application can have an open handle to that socket object (the handle is basically a process-local "reference counting pointer" to an object inside the OS) and any thread inside those applications can manipulate the socket object.


Here is my doubt - To access any port, I need to bind a socket to any unique port. Now application creates a socket object, get handle and send/receive data to/from port. While this thread is using this port none can get access to this port and no-one can get handle for this socket object. That means at a particular time only 1 thread can have socket handle and use specific port. So now in my example 2 threads are using the same scenario, My question is how to identify which thread is using which port ?

I am more focusing on
Quote:
a socket object inside (port) the networking part of the OS.

Apart from above doubt I have some more -
1. How is it managed by OS network part ?
2. Why do I need to create a socket ? Why can't I directly send or receive data to/from any port ?
3. How is a data packet read by thread belongs to multi-Threaded process ?
4. Is it possible for a thread can perform any operation on same port which is being used by another thread belongs to the same process?

Please correct me if I am wrong.
SubratSarkar 31-Aug-12 2:55am View    
Deleted
Thanks for reply. I got your point but my concern with statement as you mentioned here -
"<blockquote class="FQ"><div class="FQA">Quote:</div>The address/port pair in the incoming packet identifies a machine(address) and a socket object inside (port) the networking part of the OS. Any application can have an open handle to that socket object (the handle is basically a process-local "reference counting pointer" to an object inside the OS) and any thread inside those applications can manipulate the socket object. </blockquote>

Here is my doubt - To access any port, I need to bind a socket to any unique port. Now application creates a socket object, get handle and send/receive data to/from port. While this thread is using this port none can get access to this port and no-one can get handle for this socket object. That means at a particular time only 1 thread can have socket handle and use specific port. So now in my example 2 threads are using the same scenario, My question is how to identify which thread is using which port ?

I am more focusing on <blockquote class="FQ"><div class="FQA">Quote:</div>a socket object inside (port) the networking part of the OS.</blockquote>
Apart from above doubt I have some more -
1. How is it managed by OS network part ?
2. Why do I need to create a socket ? Why can't I directly send or receive data to/from any port ?
3. How is a data packet read by thread belongs to multi-Threaded process ?
4. Is it possible for a thread can perform any operation on same port which is being used by another thread belongs to the same process?

Please correct me if I am wrong.