Added socket function