Skip to content

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 s…

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 stra…

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 strai…

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. Se…

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 Yo…