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?