Twitter ping inside proxy failed but when open from browser it open -
i have problem: when open twitter.com, opens, when use tweetinvi doesn’t work.
therefore, made code:
var result = ping.send("twitter.com"); if (result.status != system.net.networkinformation.ipstatus.success) { insertlogwithfilename("test ping : 000x" ); }
i setup proxy configuration, ping not work.
tweetinviconfig.currentthreadsettings.httprequesttimeout = 5000000; tweetinviconfig.currentthreadsettings.uploadtimeout = 9000000; if (noproxy == "0") { tweetinviconfig.currentthreadsettings.proxyurl = "http://" + proxyip + ":" + proxyport; } try { auth.setusercredentials(cuskey, secret, accesstoken, useraccessse); } catch (exception exp) { insertlogwithfilename("error in authentication :" + exp.message); } try { var authenticateduser = user.getauthenticateduser(); } catch (exception exp) { insertlogwithfilename("error in user authentication :" + exp.message); }
i test if connection twitter connected :
public static void testconn() { try { using (var client = new webclient()) { using (var stream = client.openread("https://www.twitter.com")) { insertlogwithfilename("test stream : 8666"); } } } catch { insertlogwithfilename("test stream : 8766"); } }
this block of code return true
public static void testconnping() { var ping = new system.net.networkinformation.ping(); var result = ping.send("twitter.com"); if (result.status != system.net.networkinformation.ipstatus.success) { insertlogwithfilename("test ping : 8766" ); //return false; } else { insertlogwithfilename("test ping : 8666"); //return true; } }
this block return false
when set tweetinviconfig.currentthreadsettings.proxyurl
not mean ping.send
use proxy. means tweetinvi use proxy.
if want check if tweetinvi accessing data, need run getauthenticateduser
method explained in documentation.
tweetinviconfig.currentthreadsettings.proxyurl = "http://..."; exceptionhandler.swallowwebexceptions = false; auth.setusercredentials("consumer_key", "consumer_secret", "access_token", "access_token_secret"); var authenticateduser = user.getauthenticateduser();
Comments
Post a Comment