in your original post you are opening another socket in one part and using an alias in another, since you didnt show the coding for those parts here its hard to help with the problems you are having.