This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM6446 socket programming build error

Hi all,

I have some problem in socket programming on DM6446 DVSDK 2.00.

The tcp/ip socket programming test source code is using normal functions that are bind,socket..etc.

But it has many error on build. To fix it, -D__KERNEL__ was used in Makefile. But more many errors

exists .  

I think many header files related to socket programming in DVSDK2.00 is requiring patchs.

Is it correct? Is there any one using tcp socket well without any error in build?

 

This is portion of tcp test  programming and is very simple standard code.

#include <linux/socket.h>
#include <linux/in.h>
#include <linux/net.h>

sockfd = socket (  PF_INET,  SOCK_STREAM,   IPPROTO_TCP);
 if (sockfd < 0) {
  printf ("%s\n", strerror(errno));
  return -1;
 }

     if (setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF,  &optvalue, sizeof(optvalue)) < 0) {
  printf ("%s\n", strerror(errno));
  return -1;
 }
 
   server_addr.sin_addr.s_addr=htonl(INADDR_ANY);
     server_addr.sin_family = AF_INET;
     server_addr.sin_port = htons(port);

     if ( bind(sockfd, (struct sockaddr *) &server_addr, sizeof(server_addr)) < 0)  {
       printf ("%s\n", strerror(errno));
       return -1;
     }
 
     if (listen(sockfd, 8) < 0 ){
         printf ("%s\n", strerror(errno));
         return -1;
     }
 csock = accept(sockfd, (struct sockaddr *)&client_addr, &clen);

 write(sockfd,"abcd",4);