Skip to content

Tag: c++

Understanding getaddrinfo function in C

I’m new to C and socket programming, just a question on getaddrinfo function. The function prototype of getaddrinfo is: and getaddrinfo returns a result that points to a linked list of addrinfo structures, each of which points to a socket address structure that corresponds to host and service. Below is …

recv() skipping UDP packets

I wrote simple program to handle incoming UDP packets. I send 60000 UDP packets to and this programm is losing packets. Bandwith about 60-70 Mbit/s. If I wun tcpdump in parallel, then I see that all packages are received by the kernel. Also I tried recvmsg and recvmmsg with same result. Program source code: A…

Fork how many processes created confused

Say i have the following program So now what we have: Fork #1 creates an additional processes. so now we have two processes. Fork #2 is executed by two processes, creating two processes, for a total of four. My confusion is after the first fork we will have two processes P1(parent) and C1 (child). each proces…

different ways to ignore a signal?

Im’ new to Linux and signal handling. the signal function prototype is below is my questions: Q1-if I want to ignore SIGINT signal, then I just need to simply code as: signal(SIGINT, SIG_IGN);, is my understanding corrct? Q2-What if I code as: since my own sigint_handler does nothing, it is pretty much …

io.h not found CLion in Ubuntu 20.04

I am trying to run a c++ code however, io.h is not found. It is shown as Additionally, I am getting a bunch of weird problems (for a code that is rather > 16 years old): or or or or or or I wonder if these are related to io.h not being found. I have CLion 2020.2.3 and Answer Add

How do you create a C program that resembles the nl command in Linux?

I am working on a project to create a C program that acts just like the nl command in Linux, with the exceptions; it only accepts limited options, does not accept dashes to denote standard input, and no need for division of documents into logical pages with headers/footers. This is a link to an nl manual page…