Home > Back-end >  Iocp several problems encountered in programming, we hope to give directions!
Iocp several problems encountered in programming, we hope to give directions!

Time:09-19

1: at the time of submitting WSASend or WSARecv PPER_IO_OPERATION_DATA why this buff with GlobalAlloc whether can use the new application? What is the difference?

2: when the client has around 10000, the server sends a message to all service end, whether can directly use WSASend delivering ten thousand times, if WSASend fails and GetLastError ()!=WSA_IO_PENDING whether need to release in [1] application of buff and close the client socket? Tested directly delivered ten thousand times to reach the client's efficiency is not high, only less than half of customers to receive data, and after delivery efficiency is more and more low, seemingly will eventually lead to GetQueuedCompletionStatus cannot get WSASend after completion status? Do not achieve completion status and can lead to apply WSASend buff cannot release right leading to memory leaks, such large-scale delivery WSASend handled correctly?

Number 3: for the worker thread when the number of CPU cores * 2, invoked in a worker thread to the callback function to handle customer data, such as customer, I need to delete this customer so have to traverse the list of customers to find out the customer to delete them again, when the number of connections of traverse is bound to blocking worker threads, so I will out of the socket in the worker thread to join a list to open another thread to handle the list, but at the same time there will be a client entry and exit, so in order to avoid data conflict joined the critical protection variable, but the worker thread when there are customers into the critical protection will also enter the variable, equivalent to a worker thread is still waiting to be processed customer exit the critical section exit the thread to run normally, equivalent to or blocked? The correct way to here?

4: I am in CSDN questions and ask C currency buckle 50, but the problem didn't mention go? Issues that need to be audit?
  • Related