Added low level socket functions. Still work in progress.