Forum C# Problem with Web.Get

Problem with Web.Get

Postby ZBoT » August 22nd, 2014, 7:49 am

Why this is don't work?
Code: Select all
string responseVerifyUid = string.Empty;

PlayerIO.Web.Get("http://bla-bla-bla.php?password=****&action=verify_uid&user=" + message.GetString(0), (response) => responseVerifyUid = response.Text, (error) => PlayerIO.ErrorLog.WriteError(error.ErrorCode.ToString()));

responseVerifyUid variable does not change.
----------------------------------------------
I'm sorry for my english...
ZBoT
 
Posts: 2
Joined: May 26th, 2014, 8:44 am

Re: Problem with Web.Get

Postby Henrik » August 29th, 2014, 7:30 pm

The callback happens asynchronously, in a different thread, which means the immediately after you call Web.Get, the variable won't have changed.

If you need your code to wait for the result, you should probably continue your flow inside the success delegate.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Problem with Web.Get

Postby ZBoT » August 30th, 2014, 9:24 am

Wow, it work, thanks!
ZBoT
 
Posts: 2
Joined: May 26th, 2014, 8:44 am


Return to C#