X
xzzcq
Unregistered / Unconfirmed
GUEST, unregistred user!
在DELPHI2009中用ServerSockt发送信息时的代码如下:procedure TchatForm.memo1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);var i:integer;begin if Key = VK_Return then if IsServer then for i:=0 to ServerSocket.Socket.ActiveConnections-1 do ServerSocket.Socket.Connections.SendText(Memo1.Lines.Text) else ClientSocket.Socket.SendText(Memo1.Lines.Text);end;接收信息的代码如下:procedure TchatForm.ClientSocketRead(Sender: TObject; Socket: TCustomWinSocket);begin Memo2.Lines.Add('服务器发来的数据:'+Socket.ReceiveText);end;procedure TchatForm.ServerSocketClientRead(Sender: TObject; Socket: TCustomWinSocket);begin Memo2.Lines.Add('客户端发来的数据:'+Socket.ReceiveText);end;以上代码在无数的书中及网站上进行示例式的引用,但我在D2009中测试无论发送端还是接收端,收到到信息始终是乱吗,而不是想要的文字,这是为何,难到D2009有问题吗?[][]