• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 727
  • Last Modified:

Linux socket programming listen() problem

I have an smtp server program which accepts connections and forks child processes to handle the packet exchange. After the fork, the parent closes the child's socket and the child closes the original listen socket. When the parent shuts down, as long as any children are left I am not able to restart the program. It is unable to bind to the port. netstat does not show any process in LISTEN mode on that port, just the child process with is connection to the remote client.

Is there any way to free up the port for listening without shutting down the child processes?
0
billzxy
Asked:
billzxy
1 Solution
 
alikoankCommented:
call setsockopt with option  SO_REUSEADDR
0
 
billzxyAuthor Commented:
Great, that took care of it
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now