The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.
Private Sub getPhoneDataStream() Try 'Som kind of messaging that process is initiated Me.Text = "HTTP POST STARTED" While returnedPhoneTable.Rows.Count > 0 'Declare string to hold comma seperated phone string from datatable Dim dataRowString As String = "" 'Declare var for data row in loaded data table Dim row = returnedPhoneTable.Rows(0) 'Populate datarow string dataRowString = row("phoneList").ToString() 'Declare string() to handle split by comma Dim sites As String() = dataRowString.Split(","c) Dim sendRow As String = "" 'For each phone number build the command line 'And group together all 7 numbers For Each s As String In sites 'Get command for this particular phone postData = getCommandString(s) 'Append to sendRow with line break to send all 7 phones to monitor at once sendRow = sendRow + postData + vbCrLf Next Dim phoneWorkerThread As New Thread(AddressOf startPhoneMonitoring) phoneWorkerThread.Name = "Thread " + CStr(threadCounter) + " | [" + dataRowString + "]" ' i being the loop counter. phoneWorkerThread.Start(sendRow) Debug.Write("Threads Starting: " + phoneWorkerThread.Name) 'Declare and start individual thread for each loop 'increase counter for next loop threadCounter = threadCounter + 1 'Remove datarow just sent from datatable returnedPhoneTable.Rows.RemoveAt(0) 'Reset SendRow string sendRow = "" 'Since telephoy vendor needs about 1/2 second to process each phone...give plenty of time before next process start. System.Threading.Thread.Sleep(7000) End While 'Dim thstre As String = threadList.ToString() 'Dim dd As String = thstre Catch ex As Exception Debug.WriteLine("Error on thread " & CStr(threadCounter - 1) & vbCrLf & ex.Message.ToString) End Try End Sub 'Threaded web request Private Sub startPhoneMonitoring(ByVal sendRow As String) Try 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" sendWebRequest.ServicePoint.ConnectionLimit = 20 sendWebRequest.Timeout = 43200 Resend: Dim encodedData As New ASCIIEncoding() Dim byteArray As Byte() = encodedData.GetBytes(sendRow) sendWebRequest.ContentLength = byteArray.Length Dim newStream As Stream = sendWebRequest.GetRequestStream() newStream.Write(byteArray, 0, byteArray.Length) newStream.Close() ' The response object of 'HttpWebRequest' is assigned to a 'HttpWebResponse' variable. Using myHttpWebResponse As HttpWebResponse = CType(sendWebRequest.GetResponse(), HttpWebResponse) ' Displaying the contents of the page to the consoleor sending to web service/sql proc Using streamResponse As Stream = myHttpWebResponse.GetResponseStream() 'Next Line tricks into staying in Response Stream Loop While streamResponse.CanRead 'Declare StreamReader Dim streamRead As New StreamReader(streamResponse) 'Declare as Set Buffer Dim readBuff(5120) As [Char] 'Set counter in case 0 is returned Dim count As Integer = streamRead.Read(readBuff, 0, 5120) 'Worker section. Send to SQL If count = 0 Then 'There are times when the initial send does not trigger a response. 'If that happens, post again. Only happens on first pass through GoTo Resend Else 'Set output data variable Dim outputData As New [String](readBuff, 0, count) 'Send output to WCF outputData = Replace(outputData, "<Result", "<timeStamp>" & Now().ToString("yyyy-MM-dd HH:mm:ss.fff") & "</timeStamp><Result") 'Dim b As Boolean = sendToWebService(outputData) 'Leave next two lines in for dev and reading what is being passed to WCF Debug.WriteLine(ControlChars.Cr + outputData) End If End While End Using End Using Catch ex As Exception Debug.Write("Failed on this set: " & sendRow) End Try End Sub
|VB.Net Report Printing Issue||3||32|
|Help with converting xml file to excel using VB.NET||3||18|
|Using VS2010 I don't understand why I am not taken to the code behind file when I double click a Grid View event.||1||21|
|In an ASP.NET application in C#, how could this app evaluate the string input and send an error message back to the user that the length is wrong or in wrong format?||6||17|