c# - Failing to connect to steam with SteamKit2 -


i making trade offer bot in c# using steamkit2, , of time connecting steam. of time freezes when have output "connecting steam..." right before client.connect(); called. happens enough needs fixed, don't know problem is. here code (a lot taken steamkit2 tutorial):

using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using steamkit2;  namespace ato {     class offersender     {         string username;         string password;          steamclient client;         callbackmanager manager;         steamuser user;          bool isrunning = false;          public offersender()         {          }          public void login()         {             console.write("please enter username: ");             username = console.readline();              console.write("please enter password: ");             password = console.readline();               client = new steamclient();              manager = new callbackmanager(client);              user = client.gethandler<steamuser>();              new callback<steamclient.connectedcallback>(onconnected, manager);              new callback<steamuser.loggedoncallback>(onloggedon, manager);              isrunning = true;              console.writeline("\nconnecting steam...\n");              client.connect();                while(isrunning)             {                 manager.runwaitcallbacks(timespan.fromseconds(1));             }             console.readkey();         }          public void onconnected(steamclient.connectedcallback callback)         {             if (callback.result != eresult.ok)             {                 console.writeline("error connecting steam: {0}", callback.result);                 isrunning = false;                 return;             }              console.writeline("connected steam.\nlogging in {0}...\n", username);              user.logon(new steamuser.logondetails {                 username = username,                 password = password             });         }          public void onloggedon(steamuser.loggedoncallback callback)         {             if (callback.result == eresult.accountlogondenied)             {                 console.writeline("this account steamguard protected.");                 return;             }             if(callback.result != eresult.ok)             {                 console.writeline("unable log in steam {0}\n", callback.result);                 isrunning = false;                 return;             }             console.writeline("successfully logged in!");             environment.exit(0);         }      } } 

how fix this?

well, after banging head against keyboard finaly spoted steam requesting authcode other new computer or browser login.

and that's it...

the code below handles either authcode , twofactor authentications: https://github.com/steamre/steamkit/tree/master/samples/5.steamguard


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -