use write_log for tcp too