Thomas
Thomas

Reputation: 2959

c++ socket question

When I get a new file descriptor from accept() and fork a new process directly after that does the new process get the file descriptor? Second in the parent process can I close the descriptor or will this affect the child?

Upvotes: 2

Views: 131

Answers (1)

Mihran Hovsepyan
Mihran Hovsepyan

Reputation: 11088

  1. Yes it gets.
  2. Yes you can close the descriptor and this wouldn't affect to child (of course if you closing descriptor after fork in main process)

Upvotes: 3

Related Questions