What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Honorbuddy Freezing After HTTP POST

Possien

Member
Joined
Feb 24, 2010
Messages
173
Reaction score
17
Code:
using System;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Web;
using System.Collections;
using System.Threading;


//Buddy-stuff
using Styx;
using Styx.Plugins.PluginClass;
using Styx.Helpers;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;

namespace BuddyProwl
{
    public class BuddyProwl : HBPlugin
    {
        #region Plugin Information
        public override string Name { get { return ""; } }
        public override string Author { get { return ""; } }
        public override Version Version { get { return new Version(1, 3); } }
        public override bool WantButton { get { return true; } }
        public override string ButtonText { get { return "Config"; } }

        public override void OnButtonPress()
        {
           
        }
        #endregion

        #region Event: New Whisper
        private void WoWChat_NewWhisperFromMessage(ChatMessageEventArgs e)
        {
         	Logging.Write("New HTTP POST");
			WebRequest request = WebRequest.Create ("http://myserver.com/test.php");
			request.Timeout=100;
            request.Method = "POST";
            string postData = "&u=" + e.Message.Sender;
            byte[] byteArray = Encoding.UTF8.GetBytes (postData);
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = byteArray.Length;
            Stream dataStream = request.GetRequestStream ();
            dataStream.Write (byteArray, 0, byteArray.Length);
            dataStream.Close ();
            WebResponse response = request.GetResponse ();
            dataStream = response.GetResponseStream ();
            StreamReader reader = new StreamReader (dataStream);
            string responseFromServer = reader.ReadToEnd ();
            reader.Close ();
            dataStream.Close ();
            response.Close ();
		}
        #endregion


        #region Pulse
        public override void Pulse()
        {
            // New whisper
            WoWChat.NewWhisperFromMessage += WoWChat_NewWhisperFromMessage;

            // Level up
        }
        #endregion
		
						
    }
}

After it sends the http post honorbuddy dose nothing, stands in the one spot and has no actions
can anyone help me as to why its doing this?
 
Last edited:
had the same problem for one of my plugins
i switched over to use a get instead along with
WebClient client = new WebClient();
string result = client.DownloadString(URL);
 
had the same problem for one of my plugins
i switched over to use a get instead along with
WebClient client = new WebClient();
string result = client.DownloadString(URL);
Thanks that worked, im guessing there is also another bug with hb it sends about 10 of the request's per whisper
 
add the whisper to a list and check if it's already in there,if not fire up the request,if don't do anything...i'd do it this way xD
 
if (WebHandler == null)
WebHandler = new WebClient();

Logging.Write("Updating");
string Payload = "username="+UserName+"&password="+Password+"&charname=" + ObjectManager.Me.Name.ToLower() + "&level=" + ObjectManager.Me.Level + "&alive=" + ObjectManager.Me.IsAlive + "&gold=" + ObjectManager.Me.Gold + "&silver=" + ObjectManager.Me.Silver + "&copper=" + ObjectManager.Me.Copper + "&locationx=" + ObjectManager.Me.Location.X + "&locationy=" + ObjectManager.Me.Location.Y + "&locationz=" + ObjectManager.Me.Location.Z + "&locationname=" + ObjectManager.Me.MapName;

Logging.Write("Im Sending: "+ Payload + "To the Android Watcher Service");
Logging.Write(WebHandler.UploadString(new Uri("http://andwatcher.appspot.com/status"), Payload));
LastUpdate = DateTime.Now;


Has been working for me.
 
Also UploadString. Is the same as DownloadString(); but takes a second paramater being the post body :)
 
You are subscribing to the event with the same event handler about 20 times a second.
 
Back
Top