simple socket implementation