Forum > Networking and Web Programming
Internet Socket Installation Can't find unit Lresources
(1/1)
Ancarya:
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: ---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;
--- End code ---
/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: ---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;
--- End code ---
/usr/lib/lazarus/components/sockets/socketclient.pas(272,23) Warning: Symbol "Socket" is deprecated
--- Code: ---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;
--- End code ---
/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:
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:
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
Navigation
[0] Message Index