0

I have been trying to make a dos communication program. Upon finding the header files I would need, I realized that when I tried to link

#include<stdio.h>

#define FD_SETSIZE          1024
#define __NFDBITS           (8 * sizeof (fd_mask))
#define __FDELT(d)          ((d) / __NFDBITS)
#define __FDMASK(d)         ((fd_mask) 1 << ((d) % __NFDBITS))
#define __FDS_BITS(set) ((set)->fds_bits)
typedef long fd_mask;

typedef struct {
    fd_mask fds_bits[FD_SETSIZE / __NFDBITS];
} fd_set;

#include<sys/socket.h> 

int main(int argc , char *argv[])
{
    int socket_desc;
    socket_desc = socket(AF_INET , SOCK_STREAM , 0);
    
    if (socket_desc == -1)
    {
        printf("Could not create socket");
    }
    
    return 0;
}

When I link this code, I get an error that socket() is not defined.

Does anyone have any ideas to what the solution to this could be? Does anyone have any ideas of which library file implements the 'sock' function?

user207421
  • 305,947
  • 44
  • 307
  • 483
  • @Ryanwuzhere None of them. TCP/IP was a third-party product on MS.DOS. Microsoft didn't believe in TCP/IP until about 1995, hence this fiasco and the subseqeuent Winsock fiasco. And Watcom didn't provide it. You will need to source a third-party product. – user207421 Aug 28 '21 at 20:55
  • NB When you *link* this code you get an error that *`socket()`* is not defined. – user207421 Aug 29 '21 at 05:09

0 Answers0