Added socket attaching and removing processes