Home > Net >  Excuse me, my side every time the TCP receive after a period of time will automatically receive less
Excuse me, my side every time the TCP receive after a period of time will automatically receive less

Time:09-23

Now I've a feeling that was the cause of the network, because sometimes I can connect to other server has been receiving data for an hour or two, but sometimes more than ten minutes, there is no data, returns no data should not happen, have agreed per 5 s will send heartbeat packets to me,
This is the code I receive

I have a TCP connection, when no data is my connection state is true, not disconnected,


This exactly is what excuse me?

CodePudding user response:

Use caught software analysis, check whether actually received data, sometimes we feel not receive data is their own problems, may be the other party didn't send me, use caught software to judge the question of which side is,

CodePudding user response:

Write a log TXT file, only receive data and time record for the last time, and the amount of data has been received

CodePudding user response:

Agree with above suggestion to make a log is one of the best can detect last time and then gradually

CodePudding user response:

refer to the second floor rabbit family - second brother reply:
write a log TXT file, record the data and the time of the last received only, and the amount of data has been received

Server to the data as XML format data, a data over to a \ r \ n, so every time I read the data read a line parsing, the last time I found reading data, the XML data returned labels on. Read behind a row it has been empty, the problem is I receive data, or server push data has a problem?

CodePudding user response:

reference 3 floor wearing a treble response:
agree with above suggestion to make a log is one of the best can detect last time and then gradually screening
server to the data as XML format data, a data over to a \ r \ n, so every time I read the data read a line, the last time I found reading data, the XML data returned labels on. Read behind a row it has been empty, the problem is I receive data, or server push data has a problem?

CodePudding user response:

TextBox1. Text +=
This thread is the UI thread?
Should not, do not cause you to receive the thread across threads access controls and abnormal pulled out, this is very dangerous

CodePudding user response:

reference 5 floor yxhkami reply:
Quote: refer to the third floor wearing a treble response:

Agree with above suggestion to make a log is one of the best can detect last time and then gradually screening
server to the data as XML format data, a data over to a \ r \ n, so every time I read the data read a row, the last time I found reading data, the XML data returned labels on. Read behind a row it has been empty, the problem is I receive data, or server push data has a problem?

To download a socket test tools, baidu a lot, you know that the issue of who is,
  •  Tags:  
  • C #
  • Related