"bus error"

This is a discussion on "bus error" within the C Programming forums, part of the General Programming Boards category; I am trying to write a server program and a client program that can communicate with eachother. I am trying ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    55

    "bus error"

    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.

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,274
    Are you sure that receive_fd contains a sane value?

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    55
    Quote Originally Posted by brewbuck View Post
    Are you sure that receive_fd contains a sane value?
    Thanks , for some reason, I had set the file descriptor with a -1.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. strange "syntax error" problem :S
    By Akkernight in forum C++ Programming
    Replies: 23
    Last Post: 02-23-2009, 04:22 AM
  2. help needed on debugging "bus error"
    By wuhua in forum C Programming
    Replies: 2
    Last Post: 05-18-2007, 04:15 PM
  3. bull, I got a "bus error"
    By jjj in forum C Programming
    Replies: 2
    Last Post: 09-12-2002, 02:12 PM
  4. I'm confused about "parse error"
    By Chizzlah in forum C++ Programming
    Replies: 12
    Last Post: 09-04-2002, 03:45 PM
  5. What the heck is a "syntax error"...?
    By face_master in forum C++ Programming
    Replies: 1
    Last Post: 08-28-2001, 07:06 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21