PC Review


Reply
Thread Tools Rate Thread

Control the response of xmlHTTP

 
 
Samir Ibrahim
Guest
Posts: n/a
 
      27th Feb 2010

Hi all

I had post a question in msdn forum about how to control or manage the
response from xmlhttp request, I did not got any answer maybe because
they consider it as "malicious code".

any way, I had developed a sms/voice sending software in vb.net, every
thing works fine except if there is weak internet or delay from the
server I am sending my request to it.

I am using Microsoft XML v4 my code look like this

Let suppose I am trying to send request to imdb.com (for testing)

Public _xmlHTTP As New MSXML2.XMLHTTP ' declared in a module

Dim strResult As String
_xmlHTTP.open("POST", "http://www.imdb.com/find?s=tt", False)
_xmlHTTP.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded")
Dim parameter = "AVATAR" ' Movie name
Dim _sendText = "&q=<movie_name>".Replace("<movie_name>",parameter)
Application.DoEvents()
' send the request and the server should give response
_xmlHTTP.send(_sendText) ' here is where i want to put control.
strResult = _xmlHTTP.responseText
MsgBox(strResult)
End If

I am sending sms messages to a group, that group may consist of 1
person, or 1000 person. I am doing that be looping, so if for example i
am sending the message to a group that has 50 person, and in my loop I
reach 30, and the server hang or did not response

my program behaviour is: wait until the server response so it proceed
with the next send

what I want : giving the server 1 sec, if not response came, skip it and
send the next.

Can that be done?

TIA

Samir Ibrahim
 
Reply With Quote
 
 
 
 
Family Tree Mike
Guest
Posts: n/a
 
      27th Feb 2010
On 2/27/2010 6:52 AM, Samir Ibrahim wrote:
>
> Hi all
>
> I had post a question in msdn forum about how to control or manage the
> response from xmlhttp request, I did not got any answer maybe because
> they consider it as "malicious code".
>
> any way, I had developed a sms/voice sending software in vb.net, every
> thing works fine except if there is weak internet or delay from the
> server I am sending my request to it.
>
> I am using Microsoft XML v4 my code look like this
>
> Let suppose I am trying to send request to imdb.com (for testing)
>
> Public _xmlHTTP As New MSXML2.XMLHTTP ' declared in a module
>
> Dim strResult As String
> _xmlHTTP.open("POST", "http://www.imdb.com/find?s=tt", False)
> _xmlHTTP.setRequestHeader("Content-Type",
> "application/x-www-form-urlencoded")
> Dim parameter = "AVATAR" ' Movie name
> Dim _sendText = "&q=<movie_name>".Replace("<movie_name>",parameter)
> Application.DoEvents()
> ' send the request and the server should give response
> _xmlHTTP.send(_sendText) ' here is where i want to put control.
> strResult = _xmlHTTP.responseText
> MsgBox(strResult)
> End If
>
> I am sending sms messages to a group, that group may consist of 1
> person, or 1000 person. I am doing that be looping, so if for example i
> am sending the message to a group that has 50 person, and in my loop I
> reach 30, and the server hang or did not response
>
> my program behaviour is: wait until the server response so it proceed
> with the next send
>
> what I want : giving the server 1 sec, if not response came, skip it and
> send the next.
>
> Can that be done?
>
> TIA
>
> Samir Ibrahim


I suspect you did not get an answer before, as the question has more to
do with xmlhttp within msxml2 than it does with VB.Net.

Look at this page as an example of what you seem to be wanting to do:
http://msdn.microsoft.com/en-us/library/ms765535(VS.85).aspx.

--
Mike
 
Reply With Quote
 
Samir Ibrahim
Guest
Posts: n/a
 
      28th Feb 2010
Hi Mike,

Thank you for your guidance, actually I looked every where except the
xmlhttp itself.

I don't blame the msdn people, actually after re-read my own post, I
imagine a person who is trying to hack s site with brute-force

I will look to what you have posted, and it seem the answer the is there.

Thank you.

Samir Ibrahim


> On 2/27/2010 6:52 AM, Samir Ibrahim wrote:
>>
>> Hi all
>>
>> I had post a question in msdn forum about how to control or manage the
>> response from xmlhttp request, I did not got any answer maybe because
>> they consider it as "malicious code".
>>
>> any way, I had developed a sms/voice sending software in vb.net, every
>> thing works fine except if there is weak internet or delay from the
>> server I am sending my request to it.
>>
>> I am using Microsoft XML v4 my code look like this
>>
>> Let suppose I am trying to send request to imdb.com (for testing)
>>
>> Public _xmlHTTP As New MSXML2.XMLHTTP ' declared in a module
>>
>> Dim strResult As String
>> _xmlHTTP.open("POST", "http://www.imdb.com/find?s=tt", False)
>> _xmlHTTP.setRequestHeader("Content-Type",
>> "application/x-www-form-urlencoded")
>> Dim parameter = "AVATAR" ' Movie name
>> Dim _sendText = "&q=<movie_name>".Replace("<movie_name>",parameter)
>> Application.DoEvents()
>> ' send the request and the server should give response
>> _xmlHTTP.send(_sendText) ' here is where i want to put control.
>> strResult = _xmlHTTP.responseText
>> MsgBox(strResult)
>> End If
>>
>> I am sending sms messages to a group, that group may consist of 1
>> person, or 1000 person. I am doing that be looping, so if for example i
>> am sending the message to a group that has 50 person, and in my loop I
>> reach 30, and the server hang or did not response
>>
>> my program behaviour is: wait until the server response so it proceed
>> with the next send
>>
>> what I want : giving the server 1 sec, if not response came, skip it and
>> send the next.
>>
>> Can that be done?
>>
>> TIA
>>
>> Samir Ibrahim

>
> I suspect you did not get an answer before, as the question has more to
> do with xmlhttp within msxml2 than it does with VB.Net.
>
> Look at this page as an example of what you seem to be wanting to do:
> http://msdn.microsoft.com/en-us/library/ms765535(VS.85).aspx.
>


 
Reply With Quote
 
Samir Ibrahim
Guest
Posts: n/a
 
      3rd Mar 2010

Just for the record.

I found the solution which work well(at my case) by using WebRequest
instead of xmlhttp

Dim myWebRequest As WebRequest = WebRequest.Create(url)
myWebRequest.Timeout = 1000

Thank you Mike for the hint about "Timeout"

Samir Ibrahim
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
set the value of a control in response to a control or event =?Utf-8?B?Y2FudHRvZ2dsZQ==?= Microsoft Access Form Coding 0 21st Sep 2006 10:51 PM
can you control where response.writes? D Microsoft ASP .NET 4 24th Aug 2006 05:38 AM
Default response in a new control based on a prior control's respo =?Utf-8?B?TWVsaXNzYQ==?= Microsoft Access Forms 3 1st Jul 2005 07:20 PM
Using Response.Write or <%= in a Label Control =?Utf-8?B?UEs5?= Microsoft ASP .NET 3 6th May 2005 03:43 PM
User control's Response =?Utf-8?B?bXR2?= Microsoft ASP .NET 4 4th Jan 2005 07:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:50 AM.