curl / Mailing Lists / curl-library / Single Mail

curl-library

Fwd: Multi-uv.c with custom class

From: brano199 . via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 20 Sep 2017 15:33:18 +0200

Ok i will try to ask more concretely. Your example works really well when
loop, handle and timeout are defined as global variables. What i would like
to do is have a class which has these variables as members. What i was
trying to do was to send that class into socket action and timer as follows
>
> curl_multi_setopt(socket_wrapper.multi_handle, CURLMOPT_SOCKETDATA,
> &socket_wrapper);
> curl_multi_setopt(socket_wrapper.multi_handle, CURLMOPT_SOCKETFUNCTION,
> handle_socket);
> curl_multi_setopt(socket_wrapper.multi_handle, CURLMOPT_TIMERDATA,
> &socket_wrapper);
> curl_multi_setopt(socket_wrapper.multi_handle, CURLMOPT_TIMERFUNCTION,
> start_timeout);

In handle_socket i have modified your original example just by casting the
pointer to my class and inside create_curl_context function i remembered
context in my class and instead of doing

> context->poll_handle.data = context; i have done context->poll_handle.data
> = socket_wrapper;

to remember my whole class instead of just context.

So the question is more like that i don' t know how to pass context and
which are all of the necessary informations that need to be passed along
those functions to get it working,because apparently my code isn' t working
and i don' t even know where,i have tried debugging it.

2017-09-19 14:46 GMT+02:00 Daniel Stenberg <daniel_at_haxx.se>:

> On Sun, 17 Sep 2017, brano199 . via curl-library wrote:
>
> i am C++ developer and i am having trouble modifying this example to use
>> custom class https://curl.haxx.se/libcurl/c/multi-uv.html. Everytime i
>> am gettign stack overflow and i can' t really figure out what am i doing
>> wrong. Would you be so kind and take a look at my code?
>>
>
> That's a pretty big and wide question and I'd say a bit overwhelming to
> take on.
>
> Any chance you can isolate your problems and ask more specific qeustions?
>
> --
>
> / daniel.haxx.se
>

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-09-20