cancel
Showing results for 
Search instead for 
Did you mean: 

mss for netXduo Webserver

AZorn.1
Associate III

Hello,
i am using ThreadX and NetXduo for an ethernet applikation.

For this i need several tcp connections, all with reduced mss to about 900bytes. So i configured each socket with the nx_tcp_socket_mss_set(...) function after socketCreate, as it is supposed i guess.

So far so good, all things are working, also with reduced packet size in nx-pools.

But to the question, i also need webserver running, and therefor it is also necessary to reduce the mss, not to overshot the packetpool-size. How is this done, for the webserver sockets, as they can't be accesses through usercode.

Is it supposed to change the default mss in nx_tcp.h, as this is part of the library. I can't find any other "user" option to change mss for webserver-sockets, as to change the library-code.

is there anything else?

best regards

4 REPLIES 4
mbarg.1
Senior

I guess (your message is not clear to me) that you use one TCP server for HTTP (or an HTTP server that embeds one TCP server) and another for your data services. Correct?

HTTP server will adapt web packets to TCP server, therefore if you set your parameters both servers are using same parameters.

Or ( but it seems is not what you are looking for) use different packets pools for each server.

Websockets are only TCP sockets, webserver uses what it finds.

 

Hello,

the http-addOn in netX uses one or more tcp servers and for other data services i need to use another tcp server (and also tcp client).
For self-created sockets you can use the nx_tcp_socket_mss_set(...) function to configure the mss, but not for the tcp-sockets used by http-addOn. Because these sockets are "hidden" and not supposed to be accessed from user code.

And you are absolutely right, all tcp-sockets are using this tcp-setting, called "NX_TCP_MSS_SIZE" but this is NOT defined in the other user-config files like "nx_user.h", "tx_user.h" ...

It seems it is not supposed to reconfigure this definition, but there is no other "official"-like way.

By now my workaround is, to access the http-sockets directly from the httpServer-handle in an loop and reconfigure the mss for this sockets:

   for (uint32_t i = 0; i < this->m_HTTPServer.nx_web_http_server_tcpserver.nx_tcpserver_sessions_count; ++i) {
      NX_TCP_SOCKET *sock = &this->m_HTTPServer.nx_web_http_server_tcpserver.nx_tcpserver_sessions[i].nx_tcp_session_socket;

      if (NX_SUCCESS != (error = nx_tcp_socket_mss_set(sock, REDUCED_MSS))) {
         LOG(Logger::error, "socket mss set (0x%04X)", error);
      }
   }

To access the handle-elements is low portable and look dirty.

Have a look at NX_TCP_MSS_SIZE in nx_tcp.h; this allow to set mss size for all TCP, and HTTP server will use it unless some a lower value is requested by TCP.

nx_tcp.h includes nx_api.h which includes nx_port.h which includes nx_user.h; here is where usually you can taylor your choices.

unfortunately, NX_TCP_MSS_SIZE has no #ifndef directive and to use nx_user.h you must use a cumtom version of nx_tcp.h.

I usually exclude nx_xxx.h files and replace with my edited copy mb_nx_xxx.h, and after every fw new version, I only compare files to avoid non aligned pieces of code.  

Christian N
ST Employee

This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.