用SendBuf发送数组,为什么ReceiveBuf收不到数据?(100分)

  • 主题发起人 主题发起人 zhuchengchuan
  • 开始时间 开始时间
Z

zhuchengchuan

Unregistered / Unconfirmed
GUEST, unregistred user!
: 开发工具:Delphi7,组件TcpClient1的BlockMode为bmBlocking,TcpServer1的BlockMode为bmThreadBlocking;
发送数据事件:
var
I,J: Integer;
vSendMess: array of Byte;
k: Integer;
begin
k := 4;
SetLength(vSendMess,k);
for i := 0 to k - 1 do
vSendMess := (i + 64);
TcpClient1.SendBuf(vSendMess,SizeOf(vSendMess));
......

接收事件:
var
vReceMess: array of PChar;
k: Integer;
vReceStr: string;
begin
k := 4;
SetLength(vReceMess,k);
ClientSocket.ReceiveBuf(vReceMess,SizeOf(vReceMess));
........
vReceMess中没有数据;
 
TcpClient1.SendBuf(vSendMess[0],length(vSendMess));

ClientSocket.ReceiveBuf(vReceMess[0],length(vReceMess));
 
谢谢,按hfghfghfg的方法搞定.
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部