I am trying to write a server program and a client program that can communicate with eachother. I am trying to use the select() system call to be able to read from the terminal as well. I have tracked the point of crashing to the following lines of code, but can't figure out what the problem is:
Code:
fd_set readset, temp_readset;
FD_ZERO(&readset);
//Problem RIGHT HERE:
FD_SET(receive_fd, &readset);
temp_readset = readset;
The program crashes with a "bus error" even with the code that uses select() commented out. Furthermore, if I comment out all of the above lines, the program runs fine. I have included the necessary header files. Any clues as to what is going on? Thanks.