[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Lwip 1.3.1 TCP Retransmission problem
From: |
theflasher1986 |
Subject: |
[lwip-users] Lwip 1.3.1 TCP Retransmission problem |
Date: |
Tue, 1 Mar 2011 13:31:14 -0800 (PST) |
Hello, i am new to lwip and at the moment i am trying to send data from a
client to server and back.
First some information: i am using
Lwip version 1.3.1
and RTOS CooCox Coos
I started with a NXP LPC1766 LwIP Example Code from the CooCox page and
improved it a little bit.
As Api i used the netconn-Api:
Ok i have a little server-application.What i am doing with it? I have a
client which sends messages to this server and the server than sends first a
prefix of a message back following by the real message. The Client waits for
this message and than sends the next. Like a circle.
(if i say send i mean the prefix + message send together)
The problem is, between the eight and ninth send from the server to client i
get a lot of TCP-retransmissions.It takes about 2 secondes before the ninth
send can be done. The same problem occurs after the 17. send or the 26.
send. (8-9, 17-18, 26-27, 35-36 ...) It is periodic.
I have a wireshark file for you, so you can better understand what i mean.
http://old.nabble.com/file/p31044517/wireshark.pcap wireshark.pcap
Below i have posted my source code, so maybe sobody can discover a bug or
anything.
it would be very nice if someone has an advice for me, thats really a tricky
situation for a newbie like me.
I tried to adjust some parameters but nothing helped really.
greetings
theflasher
void http_server(void *pdata) {
struct netconn *conn, *newconn;
/* Create a new TCP connection handle */
conn = netconn_new(NETCONN_TCP);
/* Bind to port 80 (HTTP) with default IP address */
netconn_bind(conn, NULL, 62000);
/* Put the connection into LISTEN state */
netconn_listen(conn);
while(1) {
newconn = netconn_accept(conn);
http_server_serve(newconn);
netconn_delete(newconn);
}
}
void http_server_serve(struct netconn *conn)
{
struct netbuf *inbuf;
char *buf;
u16_t buflen;
char* msg = "SET_PORT_TYPE_OK"; //16 chars long
while(conn->err == ERR_OK)
{
/* Read the data from the port, blocking if nothing yet there.
We assume the request (the part we care about) is in one netbuf */
inbuf = netconn_recv(conn);
if (netconn_err(conn) == ERR_OK)
{
netbuf_data(inbuf, (void **)&buf, &buflen);
printf("message: %s\n",buf);
netbuf_delete(inbuf);
sendPrefix(conn,16);
//sendprefix(..): puts 16 into a char[]-Array, which is 4 Byte long and
sends it by netconn_write(..)
netconn_write(conn, msg, 16, NETCONN_COPY);
}
}
/* Close the connection (server closes in HTTP) */
netconn_close(conn);
printf("connection closed\n");
/* Delete the buffer (netconn_recv gives us ownership,
so we have to make sure to deallocate the buffer) */
netbuf_delete(inbuf);
}
--
View this message in context:
http://old.nabble.com/Lwip-1.3.1-TCP-Retransmission-problem-tp31044517p31044517.html
Sent from the lwip-users mailing list archive at Nabble.com.
- [lwip-users] Lwip 1.3.1 TCP Retransmission problem,
theflasher1986 <=