WSASend发送问题
得到WSAsend发送的套接字后,直接 call WSASend 数据发送完成后,客户端就会断掉,服务端确认收到数据,和服务端无关,
代码:
SocketHander:= Get_DWORD(dwbase+$74);
if SocketHander = 0 then Exit;
OutputDebugStringA(PChar(Format('SocketHander:%.8x,SendIndex:%.8x',)));
FillChar(pBuffers,SizeOf(TWsaBuf),$00);
pBuffers.len:= len;
pBuffers.buf:= dword(@buf);
FillChar(Overlapped,SizeOf(TOverlapped),$00);
BytesSent.len:= 0;
pBuffers.len:= len;
asm
pushad
mov edi,len
mov esi,dwbase
push0// Callback = nil
lea edx,Overlapped
pushedx
push0//Flags
lea eax,BytesSent
pusheax
push1
lea edx,pBuffers
pushedx//pBuffers
pushSocketHander//Socket
callWSASend//callws2_32.WSASend
callWSAGetLastError
mov WSALastError,eax
popad
end;
OutputDebugStringA(PChar(Format('WSALastError:%d',)));
***************************************************************************************************************
od调试:
游戏发送情况:
0012E638 00636478/CALL 到 WSASend 来自 Game.00636473
0012E63C 00000638|Socket = 638
0012E640 1A0B72B0|pBuffers = 1A0B72B0
0012E644 00000001|nBuffers = 1
0012E648 0012E65C|pBytesSent = 0012E65C
0012E64C 00000000|Flags = 0
0012E650 1A0B7280|pOverlapped = 1A0B7280
0012E654 00000000\Callback = NULL
|pBuffers:
1A0B72B01D 00 00 00 48 73 0B 1A ...Hs
|pBuffers.buffer:
1A0B7348B1 FF 26 B4 49 07 DE 09 33 D6 BB 56 A0 47 F0 F9?&碔?3只V燝瘗
1A0B735804 62 A8 8C AD 86 C1 92 AC 1B 22 67 3D b▽瓎翏?"g=J
***************************************************************************************************************
dll发送情况:
0712F494 06B96AA6/CALL 到 WSASend 来自 06B96AA1
0712F498 00000638|Socket = 638
0712F49C 0712F524|pBuffers = 0712F524
0712F4A0 00000001|nBuffers = 1
0712F4A4 0712F52C|pBytesSent = 0712F52C
0712F4A8 00000000|Flags = 0
0712F4AC 0712F530|pOverlapped = 0712F530
0712F4B0 00000000\Callback = NULL
|pBuffers:
0712F5241D 00 00 00 B0 78 F3 06 ...皒?..
|pBuffers.buffer:
06F378B0B1 FF 26 B4 49 07 DE 09 33 D6 BB 56 A0 47 F0 F9?&碔?3只V燝瘗
06F378C004 62 A8 8C AD 86 C1 92 AC 1B 22 67 3D b▽瓎翏?"g=...
***************************************************************************************************************
求解,这种以前用send调用游戏都没问题... WSASend调用就都这问题..最近又碰到。 帖子不错 万一火了呢
页:
[1]