Added (untested) socket functionality.
Works on #1