0

I wrote a simple program in linux where it creates the socket id(got socket FD as 3), prints it and close it. Just before closing it will wait for user input. I started one more program instance in different shell. Second program also created socket but got same socket FD i.e., 3. Then i extended the program to create two sockets in the same program. Now i got socket FD as 3 and 4.

Now my doubt is whether Socket FD values are specific to a process? If so, how does select call will correctly identifies which socket got the data?

4

1 に答える 1

1

ファイル記述子は、プログラムの実行中のインスタンスに固有であるため、結果は正しいです。それらは一意であるため、select() も問題ありません。

于 2013-08-26T16:49:22.033 に答える