Skip to content

Tag: sockets

issues using waitpid() with large number of child process

I have a c program to create a TCP socket and keep waiting for a connection in an infinite loop. Each time a client connected to the program, I would spawn a new child process to handle the client request. My program could only exit with signal interrupt (e.g. ctrl+c). I don’t want the parent process hanging there and wait

How to check if the IP address that a socket is bound to is still one of the valid machine’s addresses?

Once I call socket(); bind() (with a specific IP address, not INADDR_ANY); listen(), there seems to be no way of determining if the IP address is still a valid address of one of the system’s interfaces. What I looked into using: Checking error with getsockopt(SO_ERROR); Using epoll()-ing on some EPOLLERR, EPOLL{,RD}HUP events; Hoping that accept() would return an error if

C sockets

The following C program calls select() to get a list of client sockets that have data in the socket buffer (using UNIX domain datagram sockets). It takes four parameters on call from a NASM program. The parameter fds_array[] is a 3-element integer array created in NASM and passed into the program. The data are passed in from NASM in rdi,

Control doesn’t move next to the select function

i am trying to implement a TCP server that accepts multiple client nodes. However, the control is just stuck at select() and not moving beyond that. This is my code: However, the control never moves beyond the select statement. It just remain there even after i open a connection to the server with telnet: Why it stuck there and how

BPF: `bpf_obj_get_info_by_fd` fails with `Invalid argument`

I try to get the fd of the BPF_MAP_TYPE_XSKMAP in my user-space program. This is the code: But unfortunately, I get an error for calling bpf_obj_get_info_by_fd(cfg->prog_fd, &prog_info, &prog_info_len): Failed to obtain prog_info 1: Invalid argument. I don’t know if this is because the XDP-program is loaded from another process? Does the same process have to obtain program information which also

What happens to TCP socket when IP address changes?

Is there any error on a socket when writing to it after IP address change? In my I’m using TCP socket, both read/write (non-passive), no TCP or application keep-alive. To inspect this case I use socat to connect to a simple echo server on my local network. The connection is OK until I change the client IP address on my