Implemented handling sockets in native code