Thread: accept()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User ~Kyo~'s Avatar
    Join Date
    Jun 2004
    Posts
    320
    Then ideally:
    Code:
    bool MySocket::HasData()              
    {
      timeval tv;   
      tv.tv_sec = 0;
      tv.tv_usec = 10000;
      fd_set readset;
      FD_ZERO(&readset);
      FD_SET(fd, &readset);
      int result = select(fd, &readset, NULL, NULL, &tv);
      if(result > 0) //Has data!
      {
        cout<<"Y";        
        return true;  
      }else return false; //No Data!
    }
    would check if I need to accept() or not? So it seems spliced some code together didn't know I could select() something that hasn't been accept()ed should work thanks;
    Last edited by ~Kyo~; 11-22-2009 at 11:04 PM.

  2. #2

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by abachler View Post
    Tch.

    Quote Originally Posted by ~Kyo~ View Post
    I am trying to write a wrapper class for simplicity around sockets so they are easily portable.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by mk27 View Post
    tch.
    wine.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using a single socket for accept() as well as connect()?
    By nkhambal in forum Networking/Device Communication
    Replies: 3
    Last Post: 10-20-2005, 05:43 AM
  2. accept() Hangs
    By Epo in forum Networking/Device Communication
    Replies: 14
    Last Post: 09-09-2005, 11:53 AM
  3. async Client/Server app, accept() stalls?
    By JaWiB in forum Networking/Device Communication
    Replies: 14
    Last Post: 01-31-2005, 05:59 PM
  4. Make accept() stop
    By b00l34n in forum Networking/Device Communication
    Replies: 28
    Last Post: 12-20-2004, 06:50 PM
  5. How to use -- scanf to accept space?
    By leena_teoh in forum C Programming
    Replies: 4
    Last Post: 02-07-2002, 11:22 AM

Tags for this Thread