Home > Software engineering >  Vb socket communication long connection packet loss problem?
Vb socket communication long connection packet loss problem?

Time:10-04

I do with vb + socket communication program, program as the server side using the socket control array (sockServer (index) accept multiple client data requests at the same time, after processing as the client sent to the server, to communicate with the server using a socket control (sockClient ()) long connection, in the event of an control array sockServer_DataArrival
Private Sub sockServer_DataArrival (Index As an Integer, ByVal bytesTotal As Long)
.
ScokServer (index). Getdata strtemp, vbstring
Doevents
.
End sub
I now on the server using the doevents, but still had a server sends data loss. Phenomenon can be stable in parallel for a period of time, after this time will be randomly in a certain loss of data on the client

CodePudding user response:

My idea is: will get package to check every time, without correct sends the message that retransmission, till the end,

CodePudding user response:

I am sending three times but not received the data, is winsock to run for a period of time will not be able to trigger DataArrival receive less than data

CodePudding user response:

Top by oneself

CodePudding user response:

Some routing connection for a long time after you didn't send and receive data will close the connection and the connection is closed on both sides will not trigger to like pulling cable to avoid this kind of situation will have a heartbeat packet mechanism has confirmed that the client and server is returned

CodePudding user response:

I send a heartbeat, connection is not DataArrival accordingly

CodePudding user response:

I also send a heartbeat packet, is the server without receiving data no trigger DataArrival events,

CodePudding user response:

Don't know how many predecessors in the TCP Socket
Send (many) send (less) send (wealth)
Has been so much illness recv (), recv (wealth)
Inside the trap!
http://bbs.csdn.net/topics/380167545

CodePudding user response:

A) you are dealing with speed to keep up with the data receiving, data buffer overflow and result in lost data,
Separate the receiving and processing procedures, asynchronous transfer data through documents,
B) the number of client connection too much at the same time,
To switch to the token cycle, only hold the token of the client to send data,

CodePudding user response:

Is not the amount of data, packet loss, with different network assistant will also have such phenomenon of packet loss, whether related to computer configuration

CodePudding user response:

Agreement is not TCP UDP?
UDP is allows packet loss,

CodePudding user response:

The protocol is TCP

CodePudding user response:

The sender send not successful case?

CodePudding user response:

The send is sent out, and DTU hardware communication serial port has detected data, but the server is not received data, caught the software also can not find the data

CodePudding user response:

Baud rate is too high, the line is not stable? So should send not success,
This doesn't sound like a problem, can only suspect a hardware failure,
  • Related