The problem is, sometimes my app crashes and sometimes it works perfectly. I debuged the app and it always throw the exception but sometimes it doesn't catch it.
If i replace throw 1; with exit(1); it works perfect.
For the exception case the stack has to be unwound between the point the exception was thrown and where it was caught. This can cause problems, e.g. half constructed objects being destructed and other stuff.
exit() just terminates the program without doing this stack unwinding.
The nfds argument specifies the range of descriptors to be tested. The first nfds descriptors shall be checked in each set; that is, the descriptors from zero through nfds-1 in the descriptor sets shall be examined.
¿Could you provide a minimal example?
I don't think that the crash is caused by recibirBuffer(), but you triggered undefined behaviour somewhere (by instance, in split() )
Ok so my app is like a bridge between a client app (Written in Actionscript) and a XBee. The problem is when i'm testing with the client it recieves and sends data perfectly but if the client disconnect and my app throw the exception my app crashes. I removed the exception part and it looks like this: