Reputation: 2899
why cannot we use process id insted of taking the port we are binding in socket programming. in socket programming we create socket and get a socket descriptor and we bind to a specific port .for multiple connection why are we not using the process id as all the connection are also a process returning the processs id?
Upvotes: 4
Views: 4568
Reputation: 73209
It's an interesting idea, but I think it would raise a few problems:
Upvotes: 9
Reputation: 310979
Because TCP has port numbers in the specification but it doesn't have process IDs.
Why would you want to use a processID that you can't control when you can control the port number? How would a process listen on multiple ports?
Upvotes: 1
Reputation: 84199
First, multiple connections can exist per process. Second, socket API is does not depend on any OS process API.
Upvotes: 5