[英]Facing an issue with recv() and send() winsock api. Recv() hangs while receving the last packet
[英]Simulate packet send and recv
我已经将发送和接收功能挂接到了游戏过程中。 现在,我可以处理发送的内容和接收的内容。
我的职能是:
int __stdcall nSend(SOCKET s, char *buf, int len,int flags)
{
UnHookFunction("ws2_32.dll", "send", KSendHook);
int result = send(s, buf, len, flags); // Send data
HookFunction("ws2_32.dll", "send", (LPVOID*) nSend, KSendHook);
return result;
}
int __stdcall nRecv(SOCKET s, char *buf, int len, int flags)
{
UnHookFunction("ws2_32.dll", "recv", KRecvHook);
int result = recv(s, buf, len, flags); // Receive data
HookFunction("ws2_32.dll", "recv", (LPVOID*) nRecv, KRecvHook);
return result;
}
我的问题是:
我迷上了这个函数,所以我只能解释和修改发送和接收的内容。 我需要像游戏一样发送新的数据包结构。 使用相同的插座。
我如何模拟钩子函数的相同套接字的send和recv?
调用挂钩的接收函数时,请根据需要调用实际的发送和接收函数。 当您有数据要返回给调用方时,请将其返回给调用方。 调用send时,获取发送的数据,确定是否要将任何内容发送到服务器,然后根据需要调用send和receive来与服务器对话。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.