7 Jun 2012 17:58
stm32: do I have to call tcp_write() even on error?
Hello,
I impelmented modbus over tcp using LwIP library. In case of modbus protocol
error i don't call tcp_write() function, is that correct?
This is my callback function on received packet.
static void modbusserver_send(struct tcp_pcb *tpcb, struct
modbusserver_struct *es)
{
struct pbuf *ptr;
err_t wr_err = ERR_OK;
while ((wr_err == ERR_OK) &&
(es->p != NULL) &&
(es->p->len <= tcp_sndbuf(tpcb)))
{
/* get pointer on pbuf from es structure */
ptr = es->p;
if (wr_err == ERR_OK)
{
u16_t plen;
plen = ptr->len;
if (plen > PROTO_TRAMA_LEN) memcpy(ProtoStatus[PROTO_TCP].InBuf,
ptr->payload, PROTO_TRAMA_LEN);
else memcpy(ProtoStatus[PROTO_TCP].InBuf, ptr->payload, plen);
(Continue reading)
RSS Feed