vb.net - Why does my code run 2 different ways with the exact same code? -


I have an application that I have developed that relay all the messages to all the clients connected to the webcuter server from the monitor websocket The messages have been received from the server for this app.

Problem

When I run my program (I start the hit in Visual Studio), it is completely ready and starts, and Most of the functionality does the same as everyone, however, I have a code that will not run uniformly. Below is a small snippet of code.

  msg = "Set monitor" sent message 2 (socket, msg, msg. msg) "set monitor 1" sand message 2 (socket, msg, msg).   

I know that two calls are always executed on SendMessage2 because the Visual Studio Debug

  we send the SendMessage2 sub Finally, we are at the end of the SendMessage2 sub, we are after our second SendMessage2 function   

I also know that when it is implemented correctly because my web server server Either one of the two blocks will output

the output runs correctly

  Client 4h Dr. connections created a new thread. Message from parsing header socket # 4: Set message from socket # 4 "Set monitor"   

output runs incorrectly when output Client4 connected new thread created connection received Message from parsing header socket # 4: "Set name monitor"

Note that from monitor application to second in second message The message is missing.

What is me

  • Using string variables to call function
  • Calling function using static string arguments (variable) Do not use the message)
  • Synclock function separately
  • SendMessage2 function inside sinklock ING
  • Function rearrangement (swapping strings to change behavior)

    TL; DR

    Why is it that whenever my code does not change, will my program execute two different methods? Am I doing something wrong when I call my SendMessage2 sub?

    I am out of ideas

    < / P>

    >

    So I thought it.

    This is not really a VB application that is messing up or not my server was debating while I was seeing the number of bytes received by my server and I noticed the following:

      Client 4 connected new thread created connection received. Read the parsing header bytes: Message from 25 socket # 4: "set name monitor" read bytes: Message from socket # 4: "set monitor 1"   

    OK, we have 25 bits New thread connection connected to client4 received from set name monitor and 22 byte set monitor1

     . Read the parsing header bytes: Message from 47 Socket # 4: "Set Monitor"   

    Both the BOOM programs were doing their job, sending the correct number of bytes each time and reading the correct number. However, the VB application is sending them back so soon that my server was reading all 47 bytes at a time instead of 25 and 22 bytes.

    Solution

    I solved this problem after storing all the bytes by applying the secondary buffer in my server, so that the first message was sent to this By way of the group many messages are found.

      / for byte check / / (j = 0; j and lt; bytes; j ++) {if (j == 0) continues is; If (readBuffer [j] == '\ x81' and ReadBuffer [j-1] == '\ x00' and readBuffer [j-2] == '\ x00') {Secondary Bytes = Bytes - j ; Printf ("The second possible message related to this message \ n is to copy it to secondary buffer. \ N"); Memcpi (secondary buffer, readbuff + j, secondarybits); break; } // END IF} // Loop / ** /     for end

  • Comments

    Popular posts from this blog

    ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

    Matlab transpose a table vector -

    c# - Textbox not clickable but editable -