问题
I hook into the send and recv functions in Windows. In some situations I modify the data that's going to be sent and read. In the send function, this is easy. I hook into the function, modify the source buffer and then pass it to the original function. But for the recv function, this is more complicated. When I've called the original recv function and I'm going to decide to add more data, I need to push data into the local queue so that the next call of recv would return those bytes. Any ideas on that?
回答1:
Your filter method should call recv() and then add your data to the end of the buffer, adjust the read count returned, and return it. No need to 'push data into the local queue'.
来源:https://stackoverflow.com/questions/19299638/fill-data-into-the-recv-buffer-locally