Comments (5)
the caller is responsible for handling errors.
Are you kidding? Because socket2 always forcibly adds SOCK_CLOSEXEC on Linux, the calling app has no way to retry without it.
Also what is WSL1?
https://learn.microsoft.com/en-us/windows/wsl/about
from socket2.
I don't think it it s a very good design to silently add a flag that the caller even didn't passed, then miserably fails because of that.
All file descriptor types in the standard library set the SOCK_CLOEXEC
flag, it's expected of types outside of it as well.
If this library has to set SOCK_CLOEXEC flag, why don't you try socket(2) call again without it when it failed?
No, socket2 is a small wrapper around system calls, the caller is responsible for handling errors.
Also what is WSL1? I'm not even sure we support that platform. It would be nice if you explain what abbreviations are before using them.
Finally, have you tried Socket::new_raw
? It's very clear from the Socket::new
documentation what flags are set and it recommends Socket::new_raw
in cases where those flags don't make sense.
from socket2.
Are you kidding? Because socket2 always forcibly adds SOCK_CLOSEXEC on Linux, the calling app has no way to retry without it.
Did you read my comment? Socket::new_raw
.
Also what is WSL1?
We support Windows, why not use that? If WSL1 doesn't support SOCK_CLOSEXEC
, something quite crucial to Unix, it's not Linux.
from socket2.
Setting CLOEXEC on file descriptors is standard for pretty much every single feature that opens a file descriptor.
The socket manpage does not even list a compatibility note when SOCK_CLOEXEC
was introduced, so it must have been there for a very long time.
If WSL1 does not support it then that is on WSL. Its spotty syscall-compatibility is a known issue and the reason why microsoft abandoned this approach and built WSL2 instead.
You could perhaps file a bug on the WSL issue tracker.
Are you even sure that it's because of that socket option? That seems to be fairly surprising to me because we also use it in the standard library. Can you provide an strace output (assuming that works on WSL1)?
from socket2.
Did you read my comment? Socket::new_raw.
Oh, I missed that part. Sorry.
Are you even sure that it's because of that socket option?
I found socket(2) was failing with -1 by exactly running via strace at my office.
A call to socket() shouldn't usually fail, and only suspicious thing I found was a SOCK_CLOEXEC flag.
However, now at home, I cannot reproduce it now by a simple C program (on a different PC).
I should look into this more, but anyway I'm closing this for now.
Sorry to have disturbed you.
from socket2.
Related Issues (20)
- msghdr as a private field in MsgHdr/MsgMutHdr HOT 2
- Set Socket interface using interface index HOT 1
- What happened to the `RAW` socket type? HOT 1
- Question: Possible to support architectures that only provide the `std::net` interface (and only TCP)? HOT 4
- Windows: `sa_family_t` should use `ADDRESS_FAMILY` from `windows-sys` HOT 5
- nonblocking connect HOT 6
- Set `ss_len` when creating `SockAddr` from std HOT 1
- Why cannot find WASStartup and WSACleanup in source code? HOT 7
- bind_device succeeds, but subsequent sends fail with no such device or address. HOT 5
- QUESTION: How to special `laddr` when dialing connection? HOT 3
- Android support HOT 3
- don'tassign8080 port
- Currently socket2 has no way to set the DF bit on packets. The attached patch adds it. HOT 3
- Error: BoxSend(Os { code: 98, kind: AddrInUse, message: "Address already in use" }) HOT 2
- How to read EventExtra from the event? HOT 2
- Support for {recv,send}mmsg HOT 2
- New release HOT 1
- socket error HOT 1
- Provide `bind_device_by_index_v{4|6}` methods for linux. HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from socket2.