I have the following socket server code for Linux using Pthreads. If I start stress testing this with: The memory increases to about 270MB then the server becomes unresponsive: On ARMv7 architecture this takes a shorter time. If I stop the requests with the for loop, the memory does not get freed up, meaning that this server would sooner or
Tag: sockets
C Server/Client with Sockets
[Just 2 minor questions on the ground of this remaining] I try to write a simple server/client in C to send messages over sockets. It must run under Linux and Windows with MinGW. I found many examples for Linux but way to many arent working with Windows. It would be really nice if you would help me. For the server
strace -e trace=network only showing SIGCHLD?
I am using the command: strace -tt -o ${filename} -e trace=network gdb –args ${EXECUTABLE} to track which system calls occur whilst connecting to and sending messages to a peer. However, I am only receiving the following entries: Should I not see the socket calls to read() close() etc? Answer Using strace with gdb –args ${EXECUTABLE} prints syscall of gdb, instead
Linux Sockets, how to get number of bytes/packets in sending buffer?
I am working on a simple network application under Linux, where I need to read the following two properties: The number of bytes in receive buffer, which are ready to be read. The number of bytes in socket send buffer, which has not been sent yet. The receive buffer (1st property) could be obtained using FIONREAD option of ioctl() function.
Socket connection in Linux
I just got a error from connect API in linux. I knew ‘connect’ will return zero if connection is successful, I got return value “3” is it error code? or is there something else what don’t know? I got value 3 from sock. Answer To get the return value of connect(), it is most straight forward to use a variable
Why can’t bash recognize the existence of a socket file
On a Linux box I want to check if a specific socket file exists. I know the socket files exists, but my checks in bash don’t show that to me: Why oh why can’t bash see that the file exists? Answer http://www.tldp.org/LDP/abs/html/fto.html Use -S to test if its a socket. -f is for regular files. See man 1 test:
Read system call taking forever on Linux
I’m writing a TCP server application in c++. I’m trying to read a line one char at a time from a socket, but the read() system call never returns. And here is the read_from_conn() function Answer The problem is that connfd wasn’t initialized.
resend packets via RAW sockets in linux
It’s needed to read raw data from one interface and send it via another. open&&config(the same for sock_raw_outer): then in cycle: then, if I catch on sock_raw_inner any packet(arp request, for example), it sended on sock_raw_inner again and again by sendto. What’s wrong? Thanks. Answer Your sock_raw_inner is still listening on every interface because the bind on eth0 you are
Prevent Docker Compose from creating separate network
I discovered that Docker Compose places containers in a separate network when using version 2 of their YAML syntax. This makes linking with existing containers difficult. Is there a way to prevent this, and revert to the behavior of version 1, without actually reverting? Answer Is there a way to prevent this, and revert to the behavior of version 1,
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