Hi,
there is an advantage of non-blocking behaviour. Normally, you should use it along with WaitSet, so you could wait for incoming connections and some other events at the same time.
But if you really need blocking behaviour, you can achieve it using WaitSet like this:
TCPServerSocket s;
s.Open(...);
...
ting::WaitSet ws(1);
ws.Add(s, ting::Waitable::READ);
...
ws.Wait();
if(s.CanRead()){
TCPSocket sock = s.Accept();
...
}else{
//error happened
...
}
...
ws.Remove(s);
--
Ivan
понедельник, 22 июля 2013 г., 0:55:19 UTC+3 пользователь Vojtěch Frič написал: