Skip to content

Tag: c++

Linux, C, epoll(), read() data incompleted?

Linux, C. Below issue only happens by using epoll(). If I use select() on server socket, there is no data loss. ============================= Update: I received errno =11 (Try again) in read(). Do I need to continue, or break the while loop? ============================= I have client side, send 1280 K data i…

there is any way to open and read a file over a SSH connection?

I have an access to some server where there is a lot of data. I can’t copy the whole of data on my computer. I can’t compile on the server the program I want because the server doesn’t have all libs I need. I don’t think that the server admin would be very happy to see me coming and as…

What is the epoch of CLOCK_TAI?

Since Linux kernel version 3.10, the function clock_gettime() now accept CLOCK_TAI. I didn’t manage to find a detailed description of this clock. What is its epoch ? EDIT 1: Just compared the output of CLOCK_REALTIME and CLOCK_TAI on my Linux 3.19 OS and it returns the exact same value (1442582497) !? I…

WIFSTOPPED is not working properly

I am trying to implement the fg command in my mini shell. The problem is as follows: A process(gedit) is started in foreground. I stop with ctrl+z and check exit my wait loop by checking the return value of WIFSTOPPED(status): I want this to resume when fg command is given: But WIFSTOPPED keeps returning non …

Signal and output in c

Some time ago I found this exercise in C: without changing the main function, so that receiving a SIGUSR1 signal output is directed and added to a file in append mode as the first parameter. At the reception of another SIGUSR1 the output is directed to the console, and so on. How do such an exercise? Answer I…

How to send image data over linux socket

I have a relatively simple web server I have written in C++. It works fine for serving text/html pages, but the way it is written it seems unable to send binary data and I really need to be able to send images. I have been searching and searching but can’t find an answer specific to this question which …