简体   繁体   中英

BAD_EXC_ACCESS with CFSocket

I'm doing a small app which has TCP/IP server. I am familiar with BSD sockets and POSIX threads, but I selected CFSocket API. I wanted to do it in non-blocking/async/(very run-loop) scenario. I read a couple of tutorials and than started coding. Everything goes fine. Code for accepting connection works fine. I got 'kCFSocketAcceptCallBack' event. Things are not so good when I start to receive a data. I got BAD_EXC_ACCESS.

Code: http://www.nopaste.pl/18ka

It's my first 'hello world' app. I doesn't know very well X-Code, but it looks like "crash" occurs in internal 'select' function. My guess is CFSocket runs another thread which does 'select' all the time. Can anybody help ?

Whole project here: http://www.speedyshare.com/file/qbXjX/Playground.zip

If you run the app with no debugger, then the iOS will create a crash log which will detail the state of the stack.

You can retrieve the crash logs from the device with Xcode in the "Organizer" window.

EXC_BAD_ACCESS signals typically occur due to bad pointers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM