Add socket library
Reformated code