求Indy10 下,利用TCP/IP协议,发送和接收二进制数数据,使用队列.可发到我.cn

解决方案 »

  1.   

    自己动动手吧,找一下indy的demo,你要是不自己看一下给你写完了估计你都不会调试
      

  2.   

    Client:
    1. SendData: if sock.Connected then
       begin
         sock.IOHandler.ReadBytes(rxbuf,Count,False);
         Move(rxbuf[0],buf,Length(rxbuf));
       end;
    2.  ReciveData: if not sock.Connected then exit ;
        SetLength(txbuf,Count);
        Move(buf,txbuf[0],Count);
        sock.IOHandler.Write(txbuf);Server:onexecute:
       AContext.Connection.IOHandler.ReadBytes(txbuf,0,True);
       Hinst:=LoadLibrary('abc.dll');
       if Hinst>0 then
       try
         FPointer:=GetProcAddress(Hinst,'start');
         if FPointer<>nil then begin
           MyFunc:=TMyAbout(FPointer);
           MyFunc(PChar(EditLicense.Text),PChar(EditAppName.Text)); 
         end
         else Memo1.Lines.Add('>>未找到相应的函数!');
       finally
         FreeLibrary(Hinst);
       end
       else Memo1.Lines.Add('>>DLL未加载成功!');
         AContext.Connection.IOHandler.Write(txbuf); --下面是我从服务器端取回数据的记录:客户端启动Connected at 2007-12-10 17:01:55
    服务器回应-->Test Program
    (SendPacket) <--55 55 55 55 AA AA AA AA 01 00 00 00 01 00 00 00 2C 00 00 00 11111111 Test_Program 这段数据记录并没有从服务器端完整的取回,正常情况下还应该取回,如(RecivePacket)-->...的数据,但现在的情况是,后面的(R..)...记录没有1.为什么客户端只显示发送过去的数据,而没有接收的数据??
    2.为什么会形成客户端死锁的现象,什么原因造成的,有什么办法解决吗?