warfley / passimplesockets Goto Github PK
View Code? Open in Web Editor NEWSimple socket API wrapper for FreePascal
License: MIT License
Simple socket API wrapper for FreePascal
License: MIT License
Hi @Warfley,
looks like we have a smidge of an issue ๐ :
./simplesockets/simplesockets.pas(586,6) Error: (5000) Identifier not found "ioctlsocket"
./simplesockets/simplesockets.pas(586,30) Error: (5000) Identifier not found "FIONREAD"
simplesockets.pas(600) Fatal: (10026) There were 2 errors compiling module, stopping
This is for the latest(trunk) and 2 early stable versions: 2.0.12 and 2.2.2.
I've done a search and ioctlsocket
is really only present under Windows, or am I wrong?
Cheers,
Gus
Hi Warfley,
Compile error on Lazarus 2.2.3 (rev lazarus_2_2_2-47-g6c1bc2c78d) FPC 3.2.3 x86_64-linux-gtk2, debian bullseye
Hint: (11030) Start of reading config file /home/ngx/gue/laz/fpc/bin/x86_64-linux/fpc.cfg
Hint: (11031) End of reading config file /home/ngx/gue/laz/fpc/bin/x86_64-linux/fpc.cfg
Free Pascal Compiler version 3.2.3-651-g682c53ff6b [2022/07/13] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
(1002) Target OS: Linux for x86-64
(3104) Compiling udpechoserver.pas
(3104) Compiling /home/ngx/gue/laz/_lib/PasSimpleSockets/simplesockets.pas
..........
/home/ngx/gue/laz/_lib/PasSimpleSockets/simplesockets.pas(348,78) Error: (4025) Incompatible type for arg no. 3: Got "^Int64", expected "pSockLen"
/home/ngx/gue/laz/fpc/units/x86_64-linux/rtl-extra/sockets.ppu:unixsock.inc(190,11) Hint: (5039) Found declaration: fpaccept(LongInt;psockaddr;pSockLen):LongInt;
/home/ngx/gue/laz/_lib/PasSimpleSockets/simplesockets.pas(382,105) Error: (4025) Incompatible type for arg no. 6: Got "^Int64", expected "pSockLen"
/home/ngx/gue/laz/fpc/units/x86_64-linux/rtl-extra/sockets.ppu:unixsock.inc(172,11) Hint: (5039) Found declaration: fprecvfrom(LongInt;Pointer;QWord;LongInt;psockaddr;pSockLen):Int64;
/home/ngx/gue/laz/_lib/PasSimpleSockets/simplesockets.pas(529,16) Error: (5000) Identifier not found "fp"
/home/ngx/gue/laz/_lib/PasSimpleSockets/simplesockets.pas(529,26) Fatal: (2003) Syntax error, ";" expected but "identifier FD_ZERO" found
Fatal: (1018) Compilation aborted
On Windows Lazarus 2.2.3 (rev lazarus_2_2_2-47-g6c1bc2c78d) FPC 3.2.3 i386-win32-win32/win64, it works
Hey Frederic (@Warfley),
I could probably pull this off if I dedicate 5 hours to stumble in the dark and then find the solution, but I'm not really that good at sockets and I lack the expertise on sockets and their APIs. So I'm really afraid of introducing inefficiency into the code.
In my opinion you first have to chose between: CRLF
, CR
or LF
and then stick to it no matter the OS's preference on how to terminate a line. I would have to have looksie on how Indy10 implements it's WriteLn
to a socket just out of curiosity.
Once that's decided, the WriteStrLn
would only be a call to WriteStr
with the chosen line termination appended at the end.
Now, the issue is now the ReadStrLn
... And I see two roads ahead:
SimpleSockets
new management of the buffer.As you can see, I got the theory or at least the gist of it ๐
But then my implementation would be a bit sloppy, or introduce some nasty inefficiencies ๐
So what do you think?
Cheers,
Gus
Hey @Warfley,
In Indy, we can define timeouts in millis for connections to fail and reading to fail.
Is this something supported at the native sockets level or is it something that Indy threw in on top?
Cheers,
Gus
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.