Recent

Author Topic: Internet Socket Installation Can't find unit Lresources  (Read 11590 times)

Ancarya

  • Newbie
  • Posts: 1
Internet Socket Installation Can't find unit Lresources
« on: November 03, 2008, 02:28:26 pm »
Also wollte die internet sockets aus dem wiki installieren, kam die fehler meldeung, dass er lresources nicht finden kann. Ersteinmal den pfad zu der lresource unit in lcl im compiler menu angegeben, hat nichts gebracht, dann den pfad in der fpc.cfg angegeben, dmit hatte ich diesen error gelöst. Jetzt allerdings zeigt er mir eine geinze reihe fehler im qeuelltext

/usr/lib/lazarus/components/sockets/socketclient.pas(226,14) Warning: Symbol "Shutdown" is deprecated
Code: [Select]
procedure TSocketClient.closeMySocket;
     begin
        if isActive
        then begin
             shutdown(mySocket,2);          !!!das ist die zeile!!!
             isActive:=false;
             mySocket:=0;
             if Assigned(FOnStateChangeEvent)
             then
                FOnStateChangeEvent(self,isActive);

             if NOT rdThread.Terminated
             then
                 rdThread.Terminate;
             rdThread.destroy;
        end;

/usr/lib/lazarus/components/sockets/socketclient.pas(262,33) Error: Illegal qualifier
/usr/lib/lazarus/components/sockets/socketclient.pas(262,55) Error: Illegal qualifier
/usr/lib/lazarus/components/sockets/socketclient.pas(262,77) Error: Illegal qualifier
/usr/lib/lazarus/components/sockets/socketclient.pas(262,99) Error: Illegal qualifier
Code: [Select]
procedure TSocketClient.setMySocket;
     var
        addr: TInetSockAddr;
        hAddr : DWord;
        tmp : String;
        tmp1 : THostAddr;
     begin
        flush(stdout);
        closeMySocket;
        rdChars:=0;
        if (clHost<>'') and (clPort>0)
        then begin
            if StrToIntDef(ExtractWord(1,clHost,['.']),0)>0
            then
               hAddr:=inetAddr(clHost)
            else begin
              With THostResolver.Create(Nil) do
                try
                  If Not NameLookup(clHost) then
                    raise ESocketError.Create(seHostNotFound, [clHost]);
                  tmp1:=HostAddress;
             tmp:=intToStr(tmp1[1])+'.'+intToStr(tmp1[2])+'.'+intToStr(tmp1[3])+'.'+intToStr(tmp1[4]);               !!!DIE ERROR Zeile!!!alle illegal qualifier errors in dieser zeile
                  hAddr:=InetAddr(tmp);
                finally
                  free;
                end;
            end;

/usr/lib/lazarus/components/sockets/socketclient.pas(272,23) Warning: Symbol "Socket" is deprecated
Code: [Select]
procedure TSocketClient.setMySocket;
     var
        addr: TInetSockAddr;
        hAddr : DWord;
        tmp : String;
        tmp1 : THostAddr;
     begin
        flush(stdout);
        closeMySocket;
        rdChars:=0;
        if (clHost<>'') and (clPort>0)
        then begin
            if StrToIntDef(ExtractWord(1,clHost,['.']),0)>0
            then
               hAddr:=inetAddr(clHost)
            else begin
              With THostResolver.Create(Nil) do
                try
                  If Not NameLookup(clHost) then
                    raise ESocketError.Create(seHostNotFound, [clHost]);
                  tmp1:=HostAddress;
             tmp:=intToStr(tmp1[1])+'.'+intToStr(tmp1[2])+'.'+intToStr(tmp1[3])+'.'+intToStr(tmp1[4]);
                  hAddr:=InetAddr(tmp);
                finally
                  free;
                end;
            end;

            addr.family:=AF_INET;
            addr.addr:=hAddr;
            addr.port:=htons(clPort);
            mySocket:=Socket(AF_INET,SOCK_STREAM,0);     !!!error zeile!!!
            if mySocket > 0
            then begin
                 if connect(mySocket,addr,sizeof(addr))
                 then begin
                      isActive:=true;
                      if Assigned(FOnStateChangeEvent)
                      then
                           FOnStateChangeEvent(self,isActive);

                      rdThread:=TSocketReadThread.Create(self);
                 end elseintTo
                      Raise ESocketError.Create(seConnectFailed,[clHost+':'+intToStr(clPort)]);
            end else
                 Raise ESocketError.Create(seCreationFailed,[SocketError]);
        end;
sem:=false;
     end;        
 
/usr/lib/lazarus/components/sockets/socketclient.pas(275,21) Warning: Symbol "Connect" is deprecated
/usr/lib/lazarus/components/sockets/socketclient.pas(362,19) Warning: Symbol "Send" is deprecated
/usr/lib/lazarus/components/sockets/socketclient.pas(502,23) Warning: Symbol "Recv" is deprecated
/usr/lib/lazarus/components/sockets/socketclient.pas(502,38) Hint: Local variable "c" does not seem to be initialized
/usr/lib/lazarus/components/sockets/socketclient.pas(531) Fatal: There were 4 errors compiling module, stopping


hmmm nehme mal an es liegt an der zeile mit den ganzen tmps ;), der rest sin ja nur warnings

system: sidux mit xfce lazarus aus den repos (debian sid)

Homero01

  • Newbie
  • Posts: 1
Re: Internet Socket Installation Can't find unit Lresources
« Reply #1 on: April 05, 2010, 04:06:03 pm »
illegall qualifier:
replace

tmp:=intToStr(tmp1[1])+'.'+intToStr(tmp1.2])+'.'+intToStr(tmp1.3])+'.'+intToStr(tmp1.[4]);

by:
   tmp:=intToStr(tmp1.s_bytes[1])+'.'+intToStr(tmp1.s_bytes[2])+'.'+intToStr(tmp1.s_bytes[3])+'.'+intToStr(tmp1.s_bytes[4]);

--------------------------------


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9993
  • FPC developer.
Re: Internet Socket Installation Can't find unit Lresources
« Reply #2 on: April 06, 2010, 10:04:33 am »
Apparantly this sourcecode hasn't been update for FPC 2.0+

The "connect" and "shutdown" etc functions have been deprecated in FPC 2.0 and were removed in fpc 2.4+:

http://wiki.freepascal.org/User_Changes_2.4.0

It can be mostly fixed by prefixing "fp" (fpconnect,fpshutdown etc), but there are some caveats, see above url

 

TinyPortal © 2005-2018