Forum > Unix
Textfiles and unix-domain sockets
MarkMLl:
Has anybody ever explored the situation where output is to go to a "named file" which can either be on disc or a unix-domain socket?
I think that they are distinct: true files need WriteLn() etc. while sockets need fpSend(). However I'd be interested in anybody else's experience in this area.
MarkMLl
marcov:
You really never realized that many socket functions have text overloads?
https://www.freepascal.org/docs-html/current/rtl/sockets/connect.html
MarkMLl:
I was- ovbiously- aware of the fact that both files and sockets are handle-based. I wasn't confident that the higher-level FPC functions would work transparently, hence my question.
Thanks for the example, which will be useful particularly if I end up looking at both ends of the connection. I'll report back if unix-domain sockets appear special in any way: I've only used them for datagrams so far.
MarkMLl
marcov:
I tried to use them a few times, but error handling gets more complex, so I abandoned it.
When I wanted to remove them at some point, Michael says he used them in a work environment
MarkMLl:
--- Quote from: marcov on January 02, 2022, 12:02:40 pm ---I tried to use them a few times, but error handling gets more complex, so I abandoned it.
When I wanted to remove them at some point, Michael says he used them in a work environment
--- End quote ---
I think the key thing is that the "handle" parameter is the same, i.e. it's not simply WriteLn() overloaded for different "handle" types.
What I'm doing is collecting instrument state via HPIB, then decoding it to a text file... and I find myself in the position that the more flexible the output is (i.e. not just stdout) the better.
MarkMLl
Navigation
[0] Message Index
[#] Next page