previous: >>108110059#define __NR_socket 41https://man7.org/linux/man-pages/man2/socket.2.htmlthis honestly ought to be one of the most popular threads i end up making in this series. sockets are a fascinating and frighteningly complex tool. they can do everything. i mean, my god. just look at this manpage. terrifying!with that being said, i haven't had much occasion to use them myself. i try to avoid networking, generally, and there are often better choices if you need IPC for something. have you ever used sockets before? if so, how? did you end up enjoying them, or would you have preferred a different tool?relevant resources: man manman syscallshttps://man7.org/linux/man-pages/https://linux.die.net/man/https://elixir.bootlin.com/linux/https://elixir.bootlin.com/musl/https://elixir.bootlin.com/glibc/
#define __NR_socket 41
man man
man syscalls
>>108120258I'd use her socket.
Yeah, I use sockets for IPC all the time.
I guess that explains why you can do networking in basically any language. Why is it that so many servers are written in Javascript and Python then if you can choose any language?
>>108121121Because people like writing programs in JavaScript or Python or sometimes even Ruby
>>108121330I can't speak for Ruby, but I'm very skeptical that anyone likes programming in JS or Python.
>>108121387Python is fucking great
>>108121402Python is fucking dog shit though
>>108121442I will stop using it now, thank you.
you can use unix domain sockets to give file descriptors to another socket. it's a nice way to make your web programs a little bit more secure
>>108121840yeah, imo sending over the file descriptors is one of the things that's most useful
>>108120258GYAAAAAAAAAAAAAAAAAAAAAAAATTTTTT
I like SO_PEERCRED. You can get the process id, user id and group id of the remote peer (when using a unix socket domain)
>>108120258Why do you have to post this kind of pic?
>>108123304erotic things stimulate the mind
>>108120258I would have said something really insightful, but not with this picture. Fuck you, OP.
>>108123304it has socks in it. plus i think dolls are cute. what exactly is wrong with it? it's barely even lewd, if at all
bampu
Where's your critique, OP? Or are you actually not aware how fucking retarded socket() in specific and kernel I/O in general is?
>>108124741well, it's a couple things. i am sick, so i'm low energy and not really feeling up for doing much. also, these threads haven't been getting a lot of engagement recently, so i wasn't sure how much i wanted to write up in the OP about it. especially since it's already such a complicated syscall, it felt like half-assing it would be worse than just not saying much at all and just trying to solicit responses from other posters. finally, as i briefly mentioned in the OP, i just don't ever really use it. 99% of the time (at least in my use cases), there have been better options for IPC, so i just use those instead
gosh.... so few posts
>>108126056I'm sorry anon... I have an exam soon and haven't used sockets pretty much since networking classes
>>108120258>doll feet
>>108126306i will forgive u just this once...>>108126372for me, i really like the joints for some reasonthe ball and... socket jointshehe
>>108120258The socket API was and continues to be, beyond the shadow of a doubt, one of the single worst API designs in the history of the entire C programming language. Sockets are not files and should not be treated as such.
>>108120258Only faggots play with dolls.
>>108126502you're not gonna believe this, but...
>>108126489>Sockets are not files and should not be treated as such.I don't mind. In fact, if we treated files a little bit more like sockets, we wouldn't have the nonsense nightmare that is blocking open(). Just imagine:>reserve a bunch of file descriptor numbers in the process' handle table>explicitly connect file descriptor number to file name during open call (can be several at once) and add them all to an epoll descriptor>you can now do other shit in your process while the kernel opens all the files in the background>libaio and io_uring have just become slightly more useful
>>108127124based
>>108120550I know what you mean(if you mean what I think you mean. Otherwise no, I have no idea what you mean).
>>108127543hehe
really not much interest in sockets, huh?
>>108120258>have you ever used sockets before? if so, how? did you end up enjoying them, or would you have preferred a different tool?I've written an HTTP server from scratch on Linux and Windows. There's no alternative.
>>108127124>we wouldn't have the nonsense nightmare that is blocking open()Did you know Windows NT has had overlapped IO ever since 3.1?
>>108120258Sockets are AWESOME>>108121121I have used sockets in C and its kinda tedious. For example, both requests and responses are sent/delivered as void*, which you can imagine is frustrating because you have to manage allocations for each element yourself. Python you can imagine does things more simply
>>108130675You are conflating two different things here: open()/NtCreateFile(), and all the other file I/O operations. open()/NtCreateFile() still block the thread, and the only thing that you can control is which thread is being blocked (also see openat2's RESOLVE_CACHED flag, which was introduced after io_uring was accepted).That being said:>completion ports: absolute fucking clusterfuck, single submissions only, meaning loads of mode switches>ReadFileScatter/WriteFileGather: multiple submissions, but all still limited to a single file handle, still limited to all reads or all writeslibaio was better, at least in terms of interface.
>>108130711>because you have to manage allocations for each element yourselfReserve-high/commit-low.