I’m learning Unix Network Programming Volume 1, I want to reproduce the accept error for RST in Linux. server: call socket(), bind(), listen(), and sleep(10) client: call socket(), connect(), setsockopt() of LINGER, close() and return server: call accept() I think that the 3rd steps will get an error like ECONNABORTED, but not. Do I want to know why? I will
Tag: unix-socket
why my unix domain socket can’t work
there are two simple program to demo the unix domain DGRAM socket. and the following is the result: it seems like nothing wrong here. but, I get nothing from the server. I don’t know why it can’t run as I expect. Answer You should be sending to /var/run/lsvr.sock not to /var/run/lcli.sock. Also you don’t have to bind in client so
Do linux read/write system calls use dynamic memory allocation?
I wonder if read and write system calls on linux (used with unix sockets) do dynamic memory allocation? The context are real time applications and deterministic behaviour. Answer No. If you look for syscalls in the Linux kernel source (I used grep -rn SYSCALL_DEFINE.*write to find read/write), you can see the source for yourself: Note that system call definitions can
Cannot get the available bytes from the unix domain socket
I am sending N bytes from a unix domain socket (AF_UNIX, SOCK_DGRAM) to another. However, if I read X bytes from the other socket, where X < N, a subsequent call to read() blocks and I cannot get the rest of the N-X bytes. Is this an expected behaviour for unix domain sockets? Is the rest of the N-X bytes
Linux/Unix Socket Self-connection
When a client try to connect to a server, if client and server are both localhost, self-connection may happen(source port and destination port happened to be the same.). But my problem is, client is not listening to that port, how can self-connection be possible? Answer We can simple reproduce this phenomenon with the following python program when we try to