locked
C++/cx setting timeout of connectasync.

    Question

  • Hi,

    I looking for example of setting timeout of connectasync function in c++/cx, I found examples in c#, but I can't rewrite it for myself. Anybody has that simple example?

    Thanks for any help.

    Tuesday, May 12, 2015 1:16 AM

All replies

  • See Creating Asynchronous Operations in C++ for Windows Store Apps for a code example and explanation of cancelling a task.

    For more info about cancellation in the PPL, see Cancellation in the PPL

    Tuesday, May 12, 2015 1:34 AM
    Owner
  • I read this tutorial and I try to figure out how can I should do it, but I cant. What I should add to this code?

    create_task(socket->ConnectAsync(hostName, port, SocketProtectionLevel::PlainSocket, connectionProfile->NetworkAdapter)).then([this](task<void> previousTask)
    	{
    		// Try getting all exceptions from the continuation chain above this point.
    		previousTask.get();
    		/*...*/
    	});


    Thursday, May 14, 2015 1:33 AM