added init() to initialize socket