473,473 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Web client load generator stops responding...

[VB2005]

Overview: I need to generate traffic to a user-defined URL in 2 ways:
connection attempts/second, and # of simultaneous connections. This
isn't the problem, though. I'm just giving you the background.

In the code below, I get 2 responses back, and all others timeout:

Public Class Request
[...]
Public Sub DoRequest(ByVal sURL As String)
Dim URL As String = sURL
Try
Dim request As WebRequest = WebRequest.Create(URL)
iSentTotal = iSentTotal + 1
Dim response As WebResponse = request.GetResponse()
iRecvdTotal = iRecvdTotal + 1
Catch ex As System.Net.WebException
iTimedOutTotal = iTimedOutTotal + 1
Console.WriteLine("Response timed out...")
Catch ex As UriFormatException
MsgBox(" Invalid URL:" & URL.ToString & vbCrLf &
ex.ToString, MsgBoxStyle.Critical)
Catch ex As Exception
MsgBox("Generic Exception:" & vbCrLf & ex.ToString,
MsgBoxStyle.Critical)
Finally
iRequestsTotal = iRequestsTotal + 1
End Try
End Sub
[...]

I call this from the main form with:

If Me.bRunning = True Then
Dim t As New Thread(New ThreadStart(AddressOf DoURL))
t.Priority = Me.ListBox1.SelectedIndex
t.IsBackground = True
t.Start()
End If

...with DoURL looking simply like:

Sub DoURL()
Dim r As New Request
r.DoRequest(txtURL.Text)
End Sub

I can't figure out if the problem is that I can't start a lot of
threads with the same variable name in the main form (t in this case),
or whether the WebRequest and WebResponse routines have some sort of
limitation.

I seem to have no trouble generating outbound requests... I still am
not sure if I can instantiate VB classes with instance names based on
variables. This would be nice! Right now it looks liek I keep making
the same thread instance name, "t", which may be at the root of the
problem. How are threads generated en masse?

TIA!

BogusException

Jul 25 '06 #1
1 1101
Resolved!

Neglected to include:

response.Close()

BogusException wrote:
[VB2005]
[...]
Public Sub DoRequest(ByVal sURL As String)
Dim URL As String = sURL
Try
Dim request As WebRequest = WebRequest.Create(URL)
iSentTotal = iSentTotal + 1
Dim response As WebResponse = request.GetResponse()
iRecvdTotal = iRecvdTotal + 1
[...]

Thanks!

BogusException

Jul 26 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lance Wynn | last post by:
Hello All, In case the subject wasn't completely clear, I just upgraded to Windows XP Pro from Windows 2000 Pro. All my ASP stuff seems to work, except that when an ASP page generates an error,...
0
by: Michael Bourgon | last post by:
I've been having the same problem for 2 weeks now. If anyone has any ideas, I'd love to hear them. We are using both SQL and Windows Authentication. I was running a Profiler Trace at the time,...
88
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
5
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
9
by: John Mark Howell | last post by:
Does anyone know if there is a utility that VS uses to generate the Strongly Typed Dataset classes for C#? Right now, it blows when you try to have a default on a DateTime column because a...
1
by: Hal | last post by:
My most sincere gratitude to anyone who can help me work around this! I have work that needs to be done in javascript on the client whenever a page is unloaded. To this end, I subscribe to...
1
by: frenchie seb via .NET 247 | last post by:
Hi ! here's the code of the function I use to send a file to the client : Private Function SendFile(ByVal fich As String, ByVal nom As String) As Boolean Try Dim oldCT As String =...
8
by: Mike Fellows | last post by:
Ok, im not sure if this is at all possible and if it is how i go about it is beyond me i have a piece of client side code that requires a piece of data from the server side (an ID number in this...
0
by: Harley | last post by:
Hello, I am just learning the tcp/ip functions etc under vb.net so please look over me if this is obviouse. I have been all over looking into any functions that I didn't totaly understand and...
9
by: gs | last post by:
the feedback for the install of c#2008 places 97 to 99% cpu load for way too long on athlon x64 3800+ PC. 3/4 an hour later its only about 80% complete, continuing with 98% CPU load! Next time...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.