apisocket write check