L
lunyx
Unregistered / Unconfirmed
GUEST, unregistred user!
我客户端和服务端都使用IDUDPServer控件(都是用D7自带的控件) ;;现在服务端广播个 消息 ,可是客户端却没收到,代码如下:
服务端:
IdUDPServer1.Active:=true;
IdUDPServer1.broadcastEnabled:=true;
IdUDPServer1.Broadcast('mmmm',89);
//其他的没设置;
客户端:
IdUDPServer2.Active:=true;
IdUDPServer2.broadcastEnabled:=true;
IdUDPServer2.defaultPort:=89;
procedure TForm1.IdUDPServer2UDPRead(Sender: TObject;
AData: TStream;
ABinding: TIdSocketHandle);
var
GetStream: TStringStream;
SoureString: String;
begin
try
application.ProcessMessages;
GetStream:=TStringStream.Create('');
Try
GetStream.CopyFrom(AData,AData.Size);
SoureString:=GetStream.DataString;
memo1.Text:=SoureString;
except
end;
finally
FreeAndNil(GetStream);
end;
end;
哪位大侠帮看一下啊 ;;
服务端:
IdUDPServer1.Active:=true;
IdUDPServer1.broadcastEnabled:=true;
IdUDPServer1.Broadcast('mmmm',89);
//其他的没设置;
客户端:
IdUDPServer2.Active:=true;
IdUDPServer2.broadcastEnabled:=true;
IdUDPServer2.defaultPort:=89;
procedure TForm1.IdUDPServer2UDPRead(Sender: TObject;
AData: TStream;
ABinding: TIdSocketHandle);
var
GetStream: TStringStream;
SoureString: String;
begin
try
application.ProcessMessages;
GetStream:=TStringStream.Create('');
Try
GetStream.CopyFrom(AData,AData.Size);
SoureString:=GetStream.DataString;
memo1.Text:=SoureString;
except
end;
finally
FreeAndNil(GetStream);
end;
end;
哪位大侠帮看一下啊 ;;