Skip to content

Tag: c++

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

C++ | How to get input from the arrow keys with Linux

I’m super new to C++ and was wanting to add arrow key functionality to my snake game. I’ve been scouring the Internet trying to find a way to do this without “conio.h” as I am using Linux. How would I go about doing this and can I get some example code? Thank you! Answer You’d be…

Pipe not reading what it should

So I have 2 processes, a client who gets 2 operands and one operation (either + or -), sends them to the second process, the server, who makes the computation, then sends the result back to the client. This is the client: This is the server: There are 3 outcomes to this code. First one is that it works, this

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…

TCP echo server doesn’t accept client

I’m trying to make an echo client server in C. The problem is, when I start the server and run the client code, in client shell it says “Connected” but in server shell it still says “Waiting for connection”. (Server doesn’t say “accept failed”. It says “Wa…