while(1)
{
read(fd,tcp_client_recvbuf,sizeof(tcp_client_recvbuf)); //读取服务端发送的数据
Can_Send_Msg(tcp_client_recvbuf[1],tcp_client_recvbuf,8); //CAN发送函数
memset(&tcp_client_recvbuf,0,sizeof(tcp_client_recvbuf));
OSTaskCreate(tcp_client_write,(void*)0,(OS_STK*)&TCPCLIENT_WRITE_TASK_STK[TCPCLIENT_WRITE_STK_SIZE-1],TCPCLIENT_WRITE_PRIO); //创建TCP客户端发送线程
}
while(1)
{
//Can_Receive_Msg(can_recvbuf); //接收下位机CAN发送的内容
//OSTaskCreate(can_recv_task,(void*)0,(OS_STK*)&CAN_TASK_STK[CAN_STK_SIZE-1],CAN_TASK_PRIO); //创建CAN接收任务
write(fd,can_recvbuf,sizeof(can_recvbuf)); //发送数据给服务端
memset(&(can_recvbuf),0,sizeof(can_recvbuf));//清除缓存区
OSTimeDlyHMSM(0,0,0,800); //延时500ms
}
}
|