login about faq

This SYNC AcceptNextConnection method returns the client socket handle this way :

clientSocket = CkSocket_AcceptNextConnection(listenSocket,0);

How to obtain the same result with the ASYNC method ?

task = CkSocket_AcceptNextConnectionAsync(listenSocket,0);

The following "CkTask_resultType(task);" return "object"

i.e. how to get the handle of an object just having the task ?

There's no problem with boolean (CkTask GetResultBool), integer CkTask GetResultInt), string results... but with an objet ?

asked May 04 '16 at 13:09

billbaxter's gravatar image


Each type of Chilkat object that can possibly be the return value of a synchronous method call will have a method named LoadTaskResult.

For example, when AcceptNextConnection is called synchronously,it would return a Socket object. When called asynchronously it returns a Task object. When the task completes, the task object (internally) has a reference to the returned Socket object.

To get the returned object (such as the Socket object), your app creates a new instance of the object and then calls LoadTaskResult. For example, in C:

HCkSocket socket = CkSocket_Create();
success = CkSocket_LoadTaskResult(socket,task)
Now you have a socket object that's been loaded with the socket object returned asynchronously in the background thread. (Actually, it's not "loaded" but the HCkSocket just references the internal socket object. The internal implementation objects are reference counted, and therefore the Task object is simply keeping a reference to the returned internal object. The LoadTaskResult method does the following: the caller discards his existing reference to the internal implementation object, and adds a reference to the implementation object held by the task.)


answered May 04 '16 at 13:20

chilkat's gravatar image

chilkat ♦♦

edited May 04 '16 at 13:21

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: May 04 '16 at 13:09

Seen: 623 times

Last updated: May 04 '16 at 13:21

powered by OSQA