紧急!!Delphi高手请进!![Fatal Error] Unit2.pas(8): File not found: 'communication.dcu'
因程序代码太长,所以只写出函数部分!!//线程执行函数,循环向队列里面写数据,做作为测试使用procedureTClientSend.send;varSendStr:st...
因程序代码太长,所以只写出函数部分!!
//线程执行函数,循环向队列里面写数据,做作为测试使用
procedure TClientSend.send;
var SendStr:string;
begin
SendStr:='welcome to program in Delphi';
while ClientSend do
begin
if ClientWriteBuffer (SendStr,Length(SendStr))<0 then
begin
ClientSend:=false;
showMessage('磁盘队列已满');
end;
Form2.TmoSend.Lines.Add(SendStr);
sleep(90);
Application.ProcessMessages;
end;
end;
//线程发送
procedure TclientSend.execute;
begin
Synchronize(send);
end;
//线程执行函数,循环从队列检测是否有可读队列,如有,便读出来
procedure TServerRecv.recv;
var RecvStr:string; Buffersize:integer;
begin
while ServerRecv do
begin
RecvStr:='';
Buffersize:=0;
ServerReadBuffer(RecvStr,Buffersize);
if Buffersize>0 then
Form2.TmoRecv.Lines.Add(RecvStr);
sleep(100);
Application.ProcessMessages;
end;
end;
//线程执行
procedure TServerRecv.execute;
begin
Synchronize(recv);
end;
//调用initClientConnect初始化服务器端的连接,开始监听。
//在服务器端建立或打开磁盘队列
procedure TForm2.BtnClientOpenClick(Sender: TObject);
begin
if not initClientConnect('127.0.0.1',1234,'f:\client.dat',1024*1024)
then raise exception.Create('error');
end;
//调用initClientConnect初始化客户端的连接。
//在客户端建立或打开磁盘队列
procedure TForm2.BtnServerOpenClick(Sender: TObject);
begin
if not initServerConnect(1234,'f:\Server.dat',1024*1024)
then raise exception.Create('error');
end;
//客户端调用线程,循环向队列里面写数据
procedure TForm2.BtnClientSendClick(Sender: TObject);
begin
ClientSend:=true;
TClientSend.Create(false);
end;
//停止客户端写队列线程
procedure TForm2.BtnClientStopClick(Sender: TObject);
begin
ClientSend:=false;
end;
//停止服务器端读读列线程
procedure TForm2.BtnServerStopClick(Sender: TObject);
begin
ServerRecv:=false;
end;
//关闭客户端的连接
procedure TForm2.BtnClientCloseClick(Sender: TObject);
begin
DisClientConnect;
end;
//关闭服务器端的连接
procedure TForm2.BtnServerCloseClick(Sender: TObject);
begin
DisServerConnect;
end;
我没有找到communication.dcu这个文件!! 展开
//线程执行函数,循环向队列里面写数据,做作为测试使用
procedure TClientSend.send;
var SendStr:string;
begin
SendStr:='welcome to program in Delphi';
while ClientSend do
begin
if ClientWriteBuffer (SendStr,Length(SendStr))<0 then
begin
ClientSend:=false;
showMessage('磁盘队列已满');
end;
Form2.TmoSend.Lines.Add(SendStr);
sleep(90);
Application.ProcessMessages;
end;
end;
//线程发送
procedure TclientSend.execute;
begin
Synchronize(send);
end;
//线程执行函数,循环从队列检测是否有可读队列,如有,便读出来
procedure TServerRecv.recv;
var RecvStr:string; Buffersize:integer;
begin
while ServerRecv do
begin
RecvStr:='';
Buffersize:=0;
ServerReadBuffer(RecvStr,Buffersize);
if Buffersize>0 then
Form2.TmoRecv.Lines.Add(RecvStr);
sleep(100);
Application.ProcessMessages;
end;
end;
//线程执行
procedure TServerRecv.execute;
begin
Synchronize(recv);
end;
//调用initClientConnect初始化服务器端的连接,开始监听。
//在服务器端建立或打开磁盘队列
procedure TForm2.BtnClientOpenClick(Sender: TObject);
begin
if not initClientConnect('127.0.0.1',1234,'f:\client.dat',1024*1024)
then raise exception.Create('error');
end;
//调用initClientConnect初始化客户端的连接。
//在客户端建立或打开磁盘队列
procedure TForm2.BtnServerOpenClick(Sender: TObject);
begin
if not initServerConnect(1234,'f:\Server.dat',1024*1024)
then raise exception.Create('error');
end;
//客户端调用线程,循环向队列里面写数据
procedure TForm2.BtnClientSendClick(Sender: TObject);
begin
ClientSend:=true;
TClientSend.Create(false);
end;
//停止客户端写队列线程
procedure TForm2.BtnClientStopClick(Sender: TObject);
begin
ClientSend:=false;
end;
//停止服务器端读读列线程
procedure TForm2.BtnServerStopClick(Sender: TObject);
begin
ServerRecv:=false;
end;
//关闭客户端的连接
procedure TForm2.BtnClientCloseClick(Sender: TObject);
begin
DisClientConnect;
end;
//关闭服务器端的连接
procedure TForm2.BtnServerCloseClick(Sender: TObject);
begin
DisServerConnect;
end;
我没有找到communication.dcu这个文件!! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询