socket write implemented