[fpc-pascal] RTL Manual pages 1056-1057 code listing question
Rick Seiden
rick at seidenmail.com
Sat May 26 18:20:35 CEST 2007
I copied the code for socksrv.pp on pages 1056-1057 into FPC, and got a
compilation error. I double checked the code, and it is the same as
what's in the manual.
My system:
Windows XP
FreePascal IDE for Win32 for i386
Target CPU: i386
Version 1.0.8 2006/08/21
(Compiler Version 2.0.4)
(Debugger GDB 6.2.1)
The error I get on Run/Compile is:
socksrv.pp(34,26) Error: Call by var parameters have to match
exactly: Got "ShortString" expected "TInetSockAddr"
The error I get is on the following line:
if not Accept(S,FromName,Sin,Sout) then
I looked in the manual, and it defines Accept as follows:
function Accept(Sock: LongInt;var Addr;var Addrlen: LongInt) : LongInt
function Accept(Sock: LongInt;var addr: TInetSockAddr;var SockIn:
File of ;var SockOut: File of ) : Boolean
function Accept(Sock: LongInt;var addr: TInetSockAddr;var SockIn:
text;var SockOut: text) : Boolean
function Accept(Sock: LongInt;var addr: String;var SockIn: text;var
SockOut: text) : Boolean
function Accept(Sock: LongInt;var addr: String;var SockIn: File of
;var SockOut: File of ) : Boolean
Based on the code, it appears that the example code is trying to use
fourth definition, but the compiler appears to be expecting the third
definition.
I have experience with Delphi, and have used it in the past to write
socket based code. I just don't have experience with FPC. Any help you
can give as to why the code from the manual isn't working would be
appreciated.
Thanks in advance
Rick
PS: I searched the archives before posting. If this is a repost, please
accept my apologies.
More information about the fpc-pascal
mailing list