I recently downloaded the Cocoa objective-c library and am attempting to make a HTTP server but having some struggles.
I want to use the CkoSocketProgress callbacks and strictly use the Async calls and not manage the background thread/event loop myself. When doing this it appears the AsyncAcceptStart method isn't working 100% as the callbacks never get notified of an accept complete.
Here's what my code does:
1) Creates a subclass of CkoSocketProgress that implements all the methods 2) Creates a CkoSocket class 3) Calls setEventCallbackObject: on CkoSocket passing in the previously made CkoSocketProgress instance 4) Calls BindAndListen:backlog on CkoSocket 5) Calls AsyncAcceptStart: with a 0ms timeout 6) Attempt connection to server
I was assuming at this point AcceptComplete on the CkoSocketProgress object would be called, however it never is.
If I instead use the blocking API of AcceptNextConnection: the server successfully accepts the incoming connection and fires the event callback.
Curious if this is the correct way to use the libraries or is actually a bug on my end? It seems odd the non-async methods will fire the callbacks but the async methods wont.
Any help greatly appreciated!
asked Feb 21 '14 at 10:29
Apologies for the duplicate, weird signup issue.
answered Feb 21 '14 at 10:31
Event callbacks will not happen for asynchronous methods running in a background thread. A callback, by definition, is something that happens in the same thread. For example:
App --> calls Chilkat method --> calls back into App ---> app returns control to Chilkat method --> Chilkat method returns control to App
answered Feb 24 '14 at 17:11