Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

From loop send to endless loop

Posted on 2013-06-26
5
Medium Priority
?
332 Views
Last Modified: 2013-06-26
I have a while statement that will run x times
Inside the While I want to kick off another sub or function (or thread???)
The problem is that the other sub is a monitoring sub...essentially an endless loop

So once I send to the sub  - sendToEndlessLoopSub(sendWebRequest, sentPostData)
It never goes to the next "While"

The sub starts with this
            Dim sendWebRequest As HttpWebRequest = CType(WebRequest.Create(stUrl), HttpWebRequest)

            sendWebRequest.SendChunked = True
            sendWebRequest.Method = "POST"
            sendWebRequest.ContentType = "text/plain"
            sendWebRequest.KeepAlive = True
            sendWebRequest.UserAgent = "CometTest"


Then to the While

While ii < row.count -1
    sentPostData = newCommandData
    sendToEndlessLoopSub(sendWebRequest, sentPostData)
End Wile

Console.Write(ControlChars.Cr + "All " & numProcesses & "Processes are running" + ControlChars.Cr)
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39279502
You can execute that method on a separate thread.
0
 

Author Comment

by:lrbrister
ID: 39279513
CodeCruiser,
  That's what I thought..and what I don't know how to do.

You have a link?"
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 39279542
Change this

sendToEndlessLoopSub(sendWebRequest, sentPostData)

to

Dim th As New Thread(AddressOf sendToEndlessLoopSub)
th.Start(arguments)

You will have to reduce the parameters to 1

http://msdn.microsoft.com/en-us/library/6x4c42hc.aspx
0
 

Author Closing Comment

by:lrbrister
ID: 39279593
That answered this question and gets me in the thread.

I'm error-ing out on that process itself.

Will try and bludgeon my way through it the rest of today and may have a new question in the morning.

Thanks.
0
 

Author Comment

by:lrbrister
ID: 39279687
CodeCruiser,
  You have no idea how much you helped over the last week.

While this is in dev, I have a solution working that I can streamline and move into a service now.

The problem was that I had a large set of phones that had to be monitored for our sales team and the data sent to SQL Server

The vendor only allowed 7 phones to be in a  "waitingtostart" monitoring status at a time

So I had to send the groups of 7 phones in a web request about 5 seconds apart

The response on each one had to be kept open so they can read straight into sql

That was the "While response.CanRead" answer you gave me the other day.

So,
I now have my loop, starting the threads, which stay open...and receive data.

Truly...thank you so much.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question