zhhyu7 opened a new pull request, #17555:
URL: https://github.com/apache/nuttx/pull/17555

   ## Summary
   TCP_CORK and TCP_NODELAY behave almost exactly the opposite, so first 
provide simple support for TCP_CORK.
   
   ## Impact
   tcp/setsockopt and getsockopt.
   
   ## Testing
   sim:matter with below code:
   ```
   #include <nuttx/config.h>
   #include <string.h>
   #include <stdio.h>
   #include <netinet/tcp.h>
   #include <sys/socket.h>
   #include <netinet/in.h>
   
   int main(int argc, FAR char *argv[])
   {
       int fd;
       int res;
       int value = atoi(argv[1]);
   
       fd = socket(AF_INET, SOCK_STREAM, 0);
       if (fd < 0)
         {
           perror("Failed to open socket");
           return -1;
         }
   
       res = setsockopt(fd, SOL_TCP, TCP_CORK, &value, sizeof(value));
       if (res < 0)
         {
           perror("Couldn't set TCP_CORK option");
         }
       else
         {
           printf("Successfully set TCP_CORK option\n");
         }
   
       close(fd);
       return res;
   }
   ```
   NuttX log:
   ```
   NuttShell (NSH) NuttX-12.11.0
   MOTD: username=admin password=Administrator
   nsh> hello 0
   Successfully set TCP_CORK option
   nsh> hello 1
   tcp_setsockopt: ERROR: TCP_CORK not supported
   Couldn't set TCP_CORK option: Error 38
   nsh> 
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to