|
From: | Noam Weissman |
Subject: | Re: [lwip-users] Tcp Server on Texas Instrument RM57 |
Date: | Sat, 29 Oct 2016 00:04:49 +0000 |
Hi,
First of all are you running with an OS or without ? Secondly do you understand that with RAW API you should not call any LwIP if the call is not from within the LwIP own context ?
As far as I see you are not copying the data into the new buffer. How is the send itself ? does the function tcpecho_raw_send copying the data to the buffer ?
RAW API means that everything you do is in the same context. If you block on the function tcpecho_raw_send and/or do something that takes too much time yes the data will not properly handled.
The code is just partial so I cannot see the picture.
I would start with setting your uint8 data[] = "TEST_DATA"; to static OUTSIDE of the function. This way it will not change when you exit from the function.
Secondly check if tcp_write uses the copy mode into an internal buffer or use a reference to data.
BR, Noam. From: lwip-users <lwip-users-bounces+address@hidden> on behalf of Julio Cesar Aguilar Zerpa <address@hidden>
Sent: Friday, October 28, 2016 4:56 PM To: address@hidden Subject: [lwip-users] Tcp Server on Texas Instrument RM57 Hi there,
I am trying to use the LwIP library (1.4.1) to create a simple tcp server on a Texas Instrument RM57. So far, I could make the "tcpecho_raw" example to work using an static ip. I also added the following function (which did not work), to be able to send data that wasn't an echo: void tcpServer_send() { uint8 data[] = "TEST_DATA"; struct pbuf* buffer = pbuf_alloc(PBUF_RAW, sizeof(data), PBUF_POOL); if (buffer) { sciDisplayText(sciREG1, txt_new_line, sizeof(txt_new_line)); sciDisplayText(sciREG1, "buffer created", sizeof("buffer created")); buffer->tot_len = sizeof(data); buffer->len = sizeof(data); buffer->payload = data; tcpecho_es->p = buffer; tcpecho_raw_send(tcpecho_raw_pcb, tcpecho_es); } } As you can see, the function prints a debug msg ("buffer created"). I modified the function 'tcpecho_raw_send' to also print a debug msg (the data being sent). When I run the program, I can see the msg "buffer created" every time the function is called, but the msg from 'tcpecho_raw_send' comes only when I close the client! (And the msg is missing the acutal data, btw). NOTE: I want to build a server that receives some commands and sends a block of data (4KB) every 60 ms. I am using the raw API because I don't want to use blocking functions (from what I understood the netconn API uses blocking functions). I would appreciate any help. Best regards, Julio Aguilar _______________________________________________ lwip-users mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/lwip-users
|
[Prev in Thread] | Current Thread | [Next in Thread] |