add socket->write function