日期:2014-05-17 浏览次数:20381 次
//$send_format: a4lllllalllllaala*a4
$send_format = "a4LLLLLaLLLLLaaLa".$packet_content_length."a4";
$bin_pack = pack($send_format,
$begin_tag,$body_tail_length,$all_packet_number,$envoy_id,$recognition_code,
$packet_id,$packet_request_type,$packet_body_length,
$packet_taskNO,$packet_middelpacketNo,$packet_minitasksequenceNo,$packet_specialkey,
$packet_trans_type,$packet_content_format,$packet_content_length,$packet_content,
$end_tag);
//----pack----------------------------------
//--------------send---------------------------
$waited_socket_write_length = BEGIN_TAG_B + BODY_TAIL_LENGTH_B + ALL_PACKET_NUMBER_B + ENVOY_ID_B + RECOGNITION_CODE_B + $body_tail_length;//20+$body_tail_length;
$actually_socket_write_length = @socket_write($socket,$bin_pack,$waited_socket_write_length);
if($actually_socket_write_length != $waited_socket_write_length)
{
socket_close($socket);
$result = array('EnglishToChineseReturn' => SOCKET_WRITE_ERROR);
return $result;
}