< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] write filehandles in buildFdSet


Experts,

Imagine that I have a test program which creates a SipStack, adds UDP
transport on port 5070, and then enters a loop that looks like this:

while (!finished) {
  FdSet fdset;
  stack.buildFdSet(fdset);
  cout << "About to select for 10000 ms" << endl;
  fdset.selectMilliSeconds(10000);

  stack.process();
}

Imagine further that I successfully run and compile such a program. 
What happens is that I get a line that says "About to select for 10000
ms" about every 10000 ms as long as nothing happens on that UDP port.

Then, I get a SIP client, and try to establish a connection using SIP
port 5070 on that machine.  This time, the select call falls through
long before the 10000 ms timeout, as expected. After that, however,
the select call falls through at every invocation.  This is because
the FdSet that is built has the file descriptor number for my UDP
socket in the write part of the select as well as the read part of the
select.

Is this desired behaviour?  Is it possible to know if there is any
data to write, and then include the write fds only in that instance?

thanks,
  Shaun