Class for socket operations