Question: In Visual Basic/VB.net, I am sending strings to another device, peer to peer, with socket programming. I created nested for loop, however, only the first

In Visual Basic/VB.net, I am sending strings to another device, peer to peer, with socket programming. I created nested for loop, however, only the first string from the for loop is being sent. I know the for loop is structured correctly because I checked the console by using Console.WriteLine statements. Could there be a timing/delay issue? How could I fix it in order for the recipient to receive all the strings? Here is the portion of the code within my button.

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Client = New TcpClient(TextBox1.Text, 5023) Dim Writer As New StreamWriter(Client.GetStream()) Dim P As Integer Dim F As Integer Dim Power As Integer Dim Frequency As Integer For P = -50 To 0 Step 10 Power = P Writer.Write(":FREQuency:STOP 1GHZ") ' Console.WriteLine("Power" & P) 'Testing if this portion of the for loop is reached Writer.Flush() For F = 50 To 1000 Step 10 Frequency = F Writer.Write(":SWEep:POINts 950") 'Console.WriteLine("Frequency" & F) 'Testing if this portion of the for loop is reached Writer.Flush() Next 'F Next ' P

End Sub

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!