Z
zbr
Unregistered / Unconfirmed
GUEST, unregistred user!
type
pRUserInfo = ^RUserInfo;
RUserInfo = record
AUserName: string;
SignSocket: TSocket;
SignInfo: string;
end;
const
SignRegister = 'AAAA';
//申请注册
SignSuccess = 'BBBB';//注册成功
SignRefuse = 'CCCC';//注册拒绝
procedure TForm1.Button2Click(Sender: TObject);
var
SocketInfo: pRUserInfo;
begin
New(SocketInfo);
try
SocketInfo.AUserName:= 'Socket1';
SocketInfo.SignSocket:= ClientSocket1.Socket.Handle;
SocketInfo.SignInfo:= SignRegister;
ClientSocket1.Socket.SendBuf(SocketInfo^,SizeOf(SocketInfo) + 1);
finally
Dispose(SocketInfo);
end;
end;
注:ClientSocket1为TClientSocket
这样写的代码,在服务端接收时,AUserName为乱码,SignInfo没有数据,请问代码哪里有问题,该如何写?谢谢! 顶者有分 。
pRUserInfo = ^RUserInfo;
RUserInfo = record
AUserName: string;
SignSocket: TSocket;
SignInfo: string;
end;
const
SignRegister = 'AAAA';
//申请注册
SignSuccess = 'BBBB';//注册成功
SignRefuse = 'CCCC';//注册拒绝
procedure TForm1.Button2Click(Sender: TObject);
var
SocketInfo: pRUserInfo;
begin
New(SocketInfo);
try
SocketInfo.AUserName:= 'Socket1';
SocketInfo.SignSocket:= ClientSocket1.Socket.Handle;
SocketInfo.SignInfo:= SignRegister;
ClientSocket1.Socket.SendBuf(SocketInfo^,SizeOf(SocketInfo) + 1);
finally
Dispose(SocketInfo);
end;
end;
注:ClientSocket1为TClientSocket
这样写的代码,在服务端接收时,AUserName为乱码,SignInfo没有数据,请问代码哪里有问题,该如何写?谢谢! 顶者有分 。