TCP sending without headers

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

TCP sending without headers

Peter LM
Hi everybody,

I have developed an HTTP server based on example supplied in "contrib stable" folder of latest lwIP release.
My problem is my server reply after an HTTP request is just composed of data ! No headers from any layer whereas every others exchange are perfectly formed!

This is a screenshot of wireshark trace:



These are my settings from lwipopts.h :

/*********************************************************/
#define BYTE_ORDER LITTLE_ENDIAN

#define XLWIP_CONFIG_INCLUDE_EMACLITE 1

#define TCPIP_THREAD_NAME   "tcpip"
#define LWIP_HTTPD_MAX_TAG_NAME_LEN 20
#define LWIP_HTTPD_MAX_TAG_INSERT_LEN 1500
#define TCPIP_THREAD_PRIO configLWIP_TASK_PRIORITY
#define TCPIP_THREAD_STACKSIZE configTCPIP_TASK_STACK_SIZE
#define DEFAULT_THREAD_STACKSIZE configDEFAULT_THREAD_STACKSIZE

#define DEFAULT_TCP_RECVMBOX_SIZE 5
#define DEFAULT_UDP_RECVMBOX_SIZE 5
#define DEFAULT_ACCEPTMBOX_SIZE 5
#define TCPIP_MBOX_SIZE 10

#define NO_SYS 0

#define LWIP_SOCKET               1

#define LWIP_NETCONN               1

#define LWIP_SNMP 0
#define LWIP_IGMP 0
#define LWIP_ICMP 1

#define LWIP_DNS 0

#define LWIP_HAVE_LOOPIF 0
#define TCP_LISTEN_BACKLOG 0
#define LWIP_SO_RCVTIMEO   1
#define LWIP_SO_RCVBUF 1
 

#define MEM_ALIGNMENT 4

#define MEM_SIZE 5120

#define MEMP_NUM_PBUF 10

#define LWIP_RAW 0
#define MEMP_NUM_RAW_PCB 2  

#define MEMP_NUM_UDP_PCB 8

#define MEMP_NUM_TCP_PCB 8

#define MEMP_NUM_TCP_PCB_LISTEN 2

#define MEMP_NUM_TCP_SEG 8

#define MEMP_NUM_SYS_TIMEOUT 10

#define MEMP_NUM_NETBUF         4

#define MEMP_NUM_NETCONN        4

#define MEMP_NUM_TCPIP_MSG_API   4
#define MEMP_NUM_TCPIP_MSG_INPKT 4

#define MEMP_NUM_ARP_QUEUE 5

#define PBUF_POOL_SIZE 22

#define PBUF_POOL_BUFSIZE 128+14+2

#define PBUF_LINK_HLEN 16

#define SYS_LIGHTWEIGHT_PROT (NO_SYS==0)

#define LWIP_TCP 1
#define TCP_TTL 255

#define TCP_QUEUE_OOSEQ 0

#define TCP_MSS 88//1460    //was 1460 but didn't work so I tried my real MSS which is MTU(128)-40

#define TCP_SND_BUF ( TCP_MSS * 2 )

#define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)

#define TCP_SNDLOWAT (TCP_SND_BUF/2)

#define TCP_WND (PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - (PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN)))
#define TCP_MAXRTX 12

#define TCP_SYNMAXRTX 4

#define LWIP_ARP 1
#define ARP_TABLE_SIZE 10
#define ARP_QUEUEING 1

#define IP_FORWARD 0

#define IP_REASSEMBLY 1
#define IP_REASS_MAX_PBUFS 10
#define MEMP_NUM_REASSDATA 10
#define IP_FRAG 0

#define ICMP_TTL 255

#define LWIP_DHCP 0

#define DHCP_DOES_ARP_CHECK (LWIP_DHCP)

#define LWIP_AUTOIP 0
#define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP && LWIP_AUTOIP)

#define LWIP_UDP 1
#define LWIP_UDPLITE 1 //Enable UDP Lite support for all API layers.
#define UDP_TTL 255

/************************************************************************/

Thank you in advance for any advice,

BR,
PLM
Reply | Threaded
Open this post in threaded view
|

Re: TCP sending without headers

vincent cui
Hi :

If you use socket api instead of RAW api, you can send the header directly before sending content.

Vincent



Vincent Cui
Firmware Engineer Leader
Shanghai Enlogic Electric Technology Co., Ltd.
Room1106, Building A, New Caohejing Business Centre, No.391, Guiping Road, Xuhui District, Shanghai, P.R.China
T: +86 21 34612525, M: +86 13482482211
www.enlogic.com
------------------------------------------------------------------------
Please consider the environment before printing this email.
------------------------------------------------------------------------
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed.  If you have received this e-mail in error, please notify the sender immediately and then delete it.  If you are not the intended recipient, you must not use, disclose or distribute this e-mail without the author's prior permission. We have taken precautions to minimize the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message.  We cannot accept liability for any loss or damage caused by software viruses.  Any views and/or opinions expressed in this e-mail are of the author only and do not necessarily represent the views of Enlogic.
------------------------------------------------------------------------
-----Original Message-----
From: lwip-users-bounces+vincent.cui=[hidden email] [mailto:lwip-users-bounces+vincent.cui=[hidden email]] On Behalf Of Peter LM
Sent: 2013年7月10日 PM 5:57
To: [hidden email]
Subject: [lwip-users] TCP sending without headers

Hi everybody,

I have developed an HTTP server based on example supplied in "contrib
stable" folder of latest lwIP release.
My problem is my server reply after an HTTP request is just composed of data
! No headers from any layer whereas every others exchange are perfectly
formed!

/This is a screenshot of wireshark trace:/

<http://lwip.100.n7.nabble.com/file/n21719/wire1.bmp>

/These are my settings from lwipopts.h :/

/*********************************************************/
#define BYTE_ORDER LITTLE_ENDIAN

#define XLWIP_CONFIG_INCLUDE_EMACLITE 1

#define TCPIP_THREAD_NAME               "tcpip"
#define LWIP_HTTPD_MAX_TAG_NAME_LEN 20
#define LWIP_HTTPD_MAX_TAG_INSERT_LEN 1500
#define TCPIP_THREAD_PRIO configLWIP_TASK_PRIORITY
#define TCPIP_THREAD_STACKSIZE configTCPIP_TASK_STACK_SIZE
#define DEFAULT_THREAD_STACKSIZE         configDEFAULT_THREAD_STACKSIZE

#define DEFAULT_TCP_RECVMBOX_SIZE 5
#define DEFAULT_UDP_RECVMBOX_SIZE 5
#define DEFAULT_ACCEPTMBOX_SIZE 5
#define TCPIP_MBOX_SIZE  10

#define NO_SYS   0

#define LWIP_SOCKET               1

#define LWIP_NETCONN                     1

#define LWIP_SNMP        0
#define LWIP_IGMP        0
#define LWIP_ICMP        1

#define LWIP_DNS         0

#define LWIP_HAVE_LOOPIF         0
#define TCP_LISTEN_BACKLOG       0
#define LWIP_SO_RCVTIMEO           1
#define LWIP_SO_RCVBUF   1


#define MEM_ALIGNMENT    4

#define MEM_SIZE         5120

#define MEMP_NUM_PBUF    10

#define LWIP_RAW         0
#define MEMP_NUM_RAW_PCB         2

#define MEMP_NUM_UDP_PCB         8

#define MEMP_NUM_TCP_PCB         8

#define MEMP_NUM_TCP_PCB_LISTEN 2

#define MEMP_NUM_TCP_SEG         8

#define MEMP_NUM_SYS_TIMEOUT    10

#define MEMP_NUM_NETBUF         4

#define MEMP_NUM_NETCONN        4

#define MEMP_NUM_TCPIP_MSG_API   4
#define MEMP_NUM_TCPIP_MSG_INPKT 4

#define MEMP_NUM_ARP_QUEUE       5

#define PBUF_POOL_SIZE   22

#define PBUF_POOL_BUFSIZE        128+14+2

#define PBUF_LINK_HLEN   16

#define SYS_LIGHTWEIGHT_PROT    (NO_SYS==0)

#define LWIP_TCP         1
#define TCP_TTL  255

#define TCP_QUEUE_OOSEQ  0

#define TCP_MSS  88//1460    //was 1460 but didn't work so I tried my real
MSS which is MTU(128)-40

#define TCP_SND_BUF      ( TCP_MSS * 2 )

#define TCP_SND_QUEUELEN         (4 * TCP_SND_BUF/TCP_MSS)

#define TCP_SNDLOWAT     (TCP_SND_BUF/2)

#define TCP_WND  (PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - (PBUF_LINK_HLEN +
PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN)))
#define TCP_MAXRTX       12

#define TCP_SYNMAXRTX    4

#define LWIP_ARP         1
#define ARP_TABLE_SIZE   10
#define ARP_QUEUEING     1

#define IP_FORWARD       0

#define IP_REASSEMBLY    1
#define IP_REASS_MAX_PBUFS       10
#define MEMP_NUM_REASSDATA       10
#define IP_FRAG  0

#define ICMP_TTL         255

#define LWIP_DHCP        0

#define DHCP_DOES_ARP_CHECK      (LWIP_DHCP)

#define LWIP_AUTOIP      0
#define LWIP_DHCP_AUTOIP_COOP   (LWIP_DHCP && LWIP_AUTOIP)

#define LWIP_UDP         1
#define LWIP_UDPLITE     1       //Enable UDP Lite support for all API layers.
#define UDP_TTL  255

/************************************************************************/

Thank you in advance for any advice,

BR,
PLM



--
View this message in context: http://lwip.100.n7.nabble.com/TCP-sending-without-headers-tp21719.html
Sent from the lwip-users mailing list archive at Nabble.com.

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: TCP sending without headers

Peter LM
I am using netconn API (sorry I did not mentioned it), could I do the same? Is that a normal behaviour?

Thank you.
Peter
Reply | Threaded
Open this post in threaded view
|

Re: TCP sending without headers

Peter LM
I read something about NOCOPY during netconn-write(), and in the contrib example the flag NOCOPY was used therefore I did the same. But It is correctl running with the flag NETCON_COPY instead of NETCONN_NOCOPY !!
Obviously I would prefer to use NOCOPY since I only send "read-only data" with the view to improve execution time and memory usage...

Any input will be welcome.
Peter
Reply | Threaded
Open this post in threaded view
|

Re: TCP sending without headers

Krzysztof Wesołowski
On Wed, Jul 10, 2013 at 1:58 PM, Peter LM <[hidden email]> wrote:
I read something about NOCOPY during netconn-write(), and in the contrib
example the flag NOCOPY was used therefore I did the same. But It is
correctl running with the flag NETCON_COPY instead of NETCONN_NOCOPY !!
Obviously I would prefer to use NOCOPY since I only send "read-only data"
with the view to improve execution time and memory usage...
 
What you mean by read only data? It must be at least:
- directly adressible (flash or RAM in MCU),
- accesible by drivers DMA (for example Core Coupled RAM on STM32F4 cannot be used).

Regards,
Krzysztof Wesołowski

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: TCP sending without headers

Peter LM
Krzysztof Wesołowski wrote
On Wed, Jul 10, 2013 at 1:58 PM, Peter LM <[hidden email]> wrote:

> I read something about NOCOPY during netconn-write(), and in the contrib
> example the flag NOCOPY was used therefore I did the same. But It is
> correctl running with the flag NETCON_COPY instead of NETCONN_NOCOPY !!
> Obviously I would prefer to use NOCOPY since I only send "read-only data"
> with the view to improve execution time and memory usage...


What you mean by read only data? It must be at least:
- directly adressible (flash or RAM in MCU),
- accesible by drivers DMA (for example Core Coupled RAM on STM32F4 cannot
be used).

Regards,
Krzysztof Wesołowski

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
I meant read only data (const variable placed in .rodata section) thus directly adressible. I'm using only 128 KB RAM. I have not used DMA yet, just memcpy ...

Regards,
Peter