Added code to allow socket reuse.