Home > Back-end >  About an IOCP control problem, the hope which Daniel can help change, thank you
About an IOCP control problem, the hope which Daniel can help change, thank you

Time:10-22

http://download.csdn.net/detail/foreverhero/2267433
This is the download link control, when multiple messages at the same time request, is received after receiving the message such as "123", and then send all online users "456", is just like group chat, at this time there will be a problem (multiple request, that is, when the multithreading, I added the critical processing function, I'm sure there is no problem, it should be sent to the client 1 "XXX1, XXX2, XXX3 XXX4", is to send four times, for example, he might be connected at a time, that is nothing, but sometimes, the data is correct, may become "XXX1XXX1XXX1XXX1", each content, and, once is sent), which Daniel can help us see hope, contact the author can not contact also, ignore me
I doubt where is change critical without, or is the problem of buffer, I am a little white, I also said not clearly, hope to help to look at, which Daniel won't cost you much time, thank you, interested to see if can add my qq: 627464, I send you my test code, you may immediately in order to find the problem, but I really can't... More than 20 days, couldn't solve

CodePudding user response:

Say to you on the QQ to glue the package, you don't believe what method...

CodePudding user response:

Watch, when you're free, help you solve

CodePudding user response:


When have free time?

CodePudding user response:

And found a new problem, if every time the need FOR loop SLEEP before sending data (20) ms then there is no any problems though occasionally still have stuck package case, but at least the data is correct

If not FOR loop before sending SLEEP20 so the client receives the data stick very badly to stick more than N, and all the data will become the last sent the
Such as originally sent is the first: XXX1, article 2: XXX2, article 3: XXX3, article 4: XXX4
And the client receives is: XXX4XXX4XXXX4XXX4

What reason is this?

CodePudding user response:

Using TCP protocol communications were need to consider the sticky problem, this need to solve by agreement, can refer to this: http://blog.csdn.net/sqldebug_fan/article/details/7907765

CodePudding user response:

Ask, short connection to consider glue bag?

CodePudding user response:

Short connection stick package must also be considered

CodePudding user response:

The connection glue bag connected with short, long, sticky package must be dealt with in network communication, when I was in the development of IOCP, wrote a lot of stick package code

CodePudding user response:

Stick packet processing belongs to the application logic, control my incompetence, want to write a little more complicated point for web applications, especially to asynchronous technology such as using IOCP, need a firm foundation of programming,
  • Related