S
sun_8113
Unregistered / Unconfirmed
GUEST, unregistred user!
我在同一界面上发送了发送IdUDPServer2.Send('192.168.7.255',5050,'aaaaaa');
然后接收会很正常.但若多发送17个以上的字符就不行了。是不是我写的有问题?我刚接触这块希望大家帮忙。代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdUDPBase, IdUDPServer, StdCtrls,IdSocketHandle,
IdUDPClient;
type
TForm1 = class(TForm)
IdUDPServer1: TIdUDPServer;
IdUDPServer2: TIdUDPServer;
Button1: TButton;
procedure IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
var
buffer: pchar;
begin
buffer := GetMemory(1024);
AData.Read(buffer^,1024);
ShowMessage(Buffer);
FreeMemory(buffer);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
// IdUDPClient1.re
//IdUDPServer2.Active := True;
IdUDPServer2.Send('192.168.7.255',5050,'aaaaaaaaaaaaaaaaaaaaaa');
end;
然后接收会很正常.但若多发送17个以上的字符就不行了。是不是我写的有问题?我刚接触这块希望大家帮忙。代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdUDPBase, IdUDPServer, StdCtrls,IdSocketHandle,
IdUDPClient;
type
TForm1 = class(TForm)
IdUDPServer1: TIdUDPServer;
IdUDPServer2: TIdUDPServer;
Button1: TButton;
procedure IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
var
buffer: pchar;
begin
buffer := GetMemory(1024);
AData.Read(buffer^,1024);
ShowMessage(Buffer);
FreeMemory(buffer);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
// IdUDPClient1.re
//IdUDPServer2.Active := True;
IdUDPServer2.Send('192.168.7.255',5050,'aaaaaaaaaaaaaaaaaaaaaa');
end;