Hi I use TCP library and my project work fine but when i receive a command from my client on PC and process data in my Embedded System it not work fine and tcp_check_send() return false!!!! This condition repeat in both Server and Client mode. I feel when i receive an command i must send any act before response it???
void send_data (U8 socket,U8 protocol, U8 p2val, U8 command) { U8 *sendbuf; /* UDP */ if (protocol == UDP) { /* Start Connection */ sendbuf = udp_get_buf (SENDLEN); sendbuf[0] = DIVICE_ADDREES_H; sendbuf[1] = DIVICE_ADDREES_L; sendbuf[2] = command; sendbuf[3] = p2val; udp_send (socket, rem_add.IP, 1001, sendbuf, SENDLEN); } /* TCP */ else if (protocol == TCP) { /* Start Connection */ switch (tcp_get_state(socket)) { case TCP_STATE_FREE: case TCP_STATE_CLOSED: tcp_connect (socket, rem_add.IP, rem_add.PORT, 0); break; case TCP_STATE_CONNECT: if (tcp_check_send (socket) != __FALSE) { sendbuf = tcp_get_buf(SENDLEN); sendbuf[0] = DIVICE_ADDREES_H; sendbuf[1] = DIVICE_ADDREES_L; sendbuf[2] = command; sendbuf[3] = p2val; tcp_send (socket, sendbuf, SENDLEN); } break; } } }