add code for working socket connection