W
wangxianjiang
Unregistered / Unconfirmed
GUEST, unregistred user!
各位,我想在ClientSocket连接服务端的时候就把一个附加信息给传过去,采用以下代码:
TShopInfo = Record
ShopNo: Integer; //分店号
ShopName: String; //分店名称
End;
pShopInfo = ^TShopInfo;
procedure connect;
var
lshop: pShopInfo;
begin
lShop := new(pShopInfo);
lshop.ShopNo := 8888;
FClientSocket.Socket.Data := lShop;
if not FClientSocket.Active then
FClientSocket.Open
else
begin
FClientSocket.Close;
FClientSocket.Open;
end;
end;
服务端在onClientconnect事件中添加以下代码:
var
i,j:integer;
lShopInfo: pShopInfo;
begin
lShopInfo := Socket.Data;//[red]这里发现Socket.Data为nil,并没有接受到传的附加信息[/red]
end
哪位知道的高手给指点一二,在此先谢过了!
TShopInfo = Record
ShopNo: Integer; //分店号
ShopName: String; //分店名称
End;
pShopInfo = ^TShopInfo;
procedure connect;
var
lshop: pShopInfo;
begin
lShop := new(pShopInfo);
lshop.ShopNo := 8888;
FClientSocket.Socket.Data := lShop;
if not FClientSocket.Active then
FClientSocket.Open
else
begin
FClientSocket.Close;
FClientSocket.Open;
end;
end;
服务端在onClientconnect事件中添加以下代码:
var
i,j:integer;
lShopInfo: pShopInfo;
begin
lShopInfo := Socket.Data;//[red]这里发现Socket.Data为nil,并没有接受到传的附加信息[/red]
end
哪位知道的高手给指点一二,在此先谢过了!