Where is "open" in "core.sys.linux.unistd"?

Steven Schveighoffer schveiguy at gmail.com
Fri Jul 9 16:03:47 UTC 2021


On 7/9/21 11:31 AM, Dennis wrote:
> On Friday, 9 July 2021 at 15:11:38 UTC, Steven Schveighoffer wrote:
>> But reading/writing, closing these file descriptors is always the same.
> 
> For sockets you'd typically use `recv` and `send` instead or `read` and 
> `write` because the former give extra options and the latter don't work 
> on Windows. But yeah, on Linux `read` and `write` should work 
> universally among file descriptors.
> 

I typically only use `send` and `recv` for for connectionless sockets. 
For TCP sockets, it's generally `read` and `write` for me (and it works 
fine).

Windows is a different story, they have different i/o routines for 
system calls (yes, there's the shims for Posix file descriptors, but I 
wouldn't use those anyway).

The larger point is that the reason `read`/`write` are separate from 
descriptor creation is because they are universal, while creation is not.

-Steve


More information about the Digitalmars-d-learn mailing list