lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] How to control TCP sending by raw API?


From: Gavin
Subject: [lwip-users] How to control TCP sending by raw API?
Date: Wed, 10 Sep 2014 03:09:03 -0700 (MST)

Hi,

I make the below test code to verify TCP sending, it works, but something is
unexpected.

const char *helloworld = "hello world\n";
const char *helloworld1 = "hello world1\n";

err_t LAN_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
{
        tcp_write(pcb, helloworld, 12, 0);
        return ERR_OK;
}

err_t LAN_sent1(void *arg, struct tcp_pcb *pcb, u16_t len)
{
        tcp_write(g_pcb, helloworld1, 13, 0);
        return ERR_OK;
}

int main()
{
...
        if ((g_pcb = tcp_new()) == NULL)
        {
                mem_free(state);
                return ERR_MEM;
        }

        tcp_arg(g_pcb, state);
        tcp_err(g_pcb, LAN_err);
        tcp_recv(g_pcb, LAN_recv);
        tcp_sent(g_pcb, NULL);

        err = tcp_connect(g_pcb, &ipaddr, SERVER_PORT, LAN_sent);
        if (err != ERR_OK)
        {
                mem_free(state);
                tcp_abort(g_pcb);
        }

        tcp_sent(g_pcb, LAN_sent1);
...
}

And I get the such result on the server;

hello world
hello world1
hello world1
hello world1
hello world1
...

I expect that "hello world1" is just printed once like "hello world".

Does anyone have some suggestions?

thanks
Gavin





--
View this message in context: 
http://lwip.100.n7.nabble.com/How-to-control-TCP-sending-by-raw-API-tp23239.html
Sent from the lwip-users mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]