lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] LPC1768/9 :: FreeRTOS 7.4 :: lwIP 1.4.1 :: TCP send/rec


From: Furiantes
Subject: Re: [lwip-users] LPC1768/9 :: FreeRTOS 7.4 :: lwIP 1.4.1 :: TCP send/recv
Date: Thu, 13 Jun 2013 10:10:27 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

Hello,

after sometime of debug, i saw:

- Server send FIN, ACK after sending the packet
- which cause the connection to go to state CLOSE_WAIT
- after that i can't write to tcp_write, device dont send any more request to a server becouse of state CLOSE_WAIT

So how to keep things alive, i tried with Keep-Alive (enabling on device + sending request with Connection: Keep-Alive).

So how I can maintain connection, to be able to send/recieve multiple times ?

If anybody can please help.

Regards,
Danijel


Dne 10.6.2013 10:38, piše Furiantes:
Hello,

i have one more problem. My goal is:

- connect to server

loop
- send request (get request like /my_php?dataFrom=[something]&dataTo=[something])
- and wait for response
while(some termination)

I did this (code below), but a second request is never sent to server. First request id OK, i get the data in processes it ok. But at the second request, netconn_write it seems it never send it to a server anything (i watch with WireShark).

I tried to connect/disconnect, close - connect, but nothing worked.

So if please can anybody tell the correct procedure to send/recieve data TCP connection.

Thanks to anybody who will even read it.

Dan



resultCon = netconn_connect(xNetConn, &remote_ip, cdata->host_port_number );

downloadBlock:
xNetConn->recv_timeout = 30000;

sprintf(request_my_c, "GET /my_php/data.php?startB=%d&lenB=%d HTTP/1.1\r\nAccept: */*\r\nAccept-Language: sl\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)\r\nHost: %d.%d.%d.%d:%d\r\nConnection: Close\r\n\r\n\0", transData,transDataLen,cdata->host_add[0],cdata->host_add[1],cdata->host_add[2],cdata->host_add[3] , cdata->host_port_number);


netconn_write(xNetConn, request_my_c, strlen(request_my_c), NETCONN_COPY);

while (1)
{

resultRecv = netconn_recv(xNetConn, &buf);

//process data
//all blocks downloaded -> break
//goto another block;

}

some code....




reply via email to

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