digitalmars.D.learn - How to tell if a file is actually a socket?
- Seth Hoenig <seth.a.hoenig gmail.com> Aug 29 2010
- orgoton baberek <sdf sa.com> Aug 30 2010
--00221538fca279ebdd048ef8df0e Content-Type: text/plain; charset=ISO-8859-1 I have a program which does a bit of scanning through files, and right now I'm running into issues where std.File.isfile() is reporting sockets as files, which is problematic, because sockets cause segfaults when I try to read them. This is the output of ls -lha on the directory with the socket: srwxr-xr-x 1 seth seth 0 2010-08-09 20:54 SingletonSocket So how can I detect if a file is actually a socket? --00221538fca279ebdd048ef8df0e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I have a program which does a bit of scanning through files, and right now = I'm running into issues where std.File.isfile() is reporting sockets as= files, which is problematic, because sockets cause segfaults when I try to= read them. <br> <br>This is the output of ls -lha on the directory with the socket:<br><br>= srwxr-xr-x=A0 1 seth seth=A0=A0=A0 0 2010-08-09 20:54 SingletonSocket<br><b= r><br>So how can I detect if a file is actually a socket?<br> --00221538fca279ebdd048ef8df0e--
Aug 29 2010
On 29/08/2010 17:30, Seth Hoenig wrote:I have a program which does a bit of scanning through files, and right now I'm running into issues where std.File.isfile() is reporting sockets as files, which is problematic, because sockets cause segfaults when I try to read them. This is the output of ls -lha on the directory with the socket: srwxr-xr-x 1 seth seth 0 2010-08-09 20:54 SingletonSocket So how can I detect if a file is actually a socket?
Try checking the output of "file" command. It should state if it is a socket or not. Also check the C library for such function and call it from D.
Aug 30 2010








orgoton baberek <sdf sa.com>