Implemented socket connection
  TODO: Does not work, fix