关于idtcpserver的问题 ( 积分: 50 )

  • 主题发起人 主题发起人 stpengpeng
  • 开始时间 开始时间
S

stpengpeng

Unregistered / Unconfirmed
GUEST, unregistred user!
客户端
mystream:=tmemorystream.Create;
myStream.Position:=0;
TCPClient.ReadStream(mystream,-1,false);
showmessage(inttostr(mystream.Position));
mystream.Read(tuser,sizeof(tuser));
showmessage(tuser.XXX);
服务器端
mystream:=tmemorystream.Create;
myStream.Position:=0;
mystream.WriteBuffer(tuser,sizeof(fuser));
athread.Connection.WriteStream(mystream,true,true,0);

这样写为什么CLIENT端收不到
 
客户端
mystream:=tmemorystream.Create;
myStream.Position:=0;
TCPClient.ReadStream(mystream,-1,false);
showmessage(inttostr(mystream.Position));
mystream.Read(tuser,sizeof(tuser));
showmessage(tuser.XXX);
服务器端
mystream:=tmemorystream.Create;
myStream.Position:=0;
mystream.WriteBuffer(tuser,sizeof(fuser));
athread.Connection.WriteStream(mystream,true,true,0);

这样写为什么CLIENT端收不到
 
没人回答我吗?
急啊··
 
服务器端
mystream:=tmemorystream.Create;
myStream.Position:=0;
mystream.WriteBuffer(tuser,sizeof(fuser));//是tuser,还是fuser
athread.Connection.WriteStream(mystream,true,true,0);
 
客户端
mystream:=tmemorystream.Create;
myStream.Position:=0;
TCPClient.ReadStream(mystream,-1,false);
showmessage(inttostr(mystream.Position));
mystream.Read(tuser,sizeof(tuser));//Read改成ReadBuffer,你的tuser应该是个缓冲区变量吧;
//然后对UDPData进行分析......RecUDPDate(s,Port,FromIP);
showmessage(tuser.XXX); //????
 
自己搞定了
 
多人接受答案了。
 

Similar threads

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