Skip to content
Advertisement

Tag: sockets

Select() to read in sockets

I have a client server client connection where the server reads the message sent by the client every 1 second but I do not want the server to keep on waiting for a message for too long. I tried using the select() function but the server continues waiting for some message to read. Could anyone tell me what I am

is rmem_default size per socket or for entire stack?

Does setting the net.core.rmem_default effect each socket or all sockets opened in the system? What is the maximum value I can configure for the net.core.rmem_default parameter? I understand it depends on RAM. Assume I have much RAM available. Answer net.core.rmem_default is the size of the incoming kernel socket buffer per one socket. From man socket(7): SO_RCVBUF Sets or gets the

Receive (recv) full request (e.g. curl HTTP)

How should this be done? I want to receive a (rather long) HTTP request and cannot get this to work. The problem: Without flags, recv does not read the whole message. I guess this is normal behavior. From what I understand using the MSG_WAITALL flag causes it to block until everything is received. However, in that case the call blocks

Sockets – keeping a socket open after data transfer

I have written simple server/client programs, in which the client sends some hardcoded data in small chunks to the server program, which is waiting for the data so that it can print it to the terminal. In the client, I’m calling send() in a loop while there is more data to send, and on the server, I’m doing the same

Sendto returning random values

I call sendto in my udp socket client side like this: but there seems to be no nothing received at the server side and in very strange fashion, num_w, when printed out, gives values like: -197379208 -1440076936 2054978424 And perror() displays “success” Client code up till that point: Thanks so much in advance! (Oh and I’m on Kali linux, virtual

TCP client cannot connect to TCP server

I have configured a Raspberry Pi to be client, and my personal computer to be TCP server, and trying to connect to server via an ethernet cable. On my personal computer I use Comm Operator and select port “1234”. Raspberry Pi (TCP client) has following setup: Raspberry Pi (TCP client) has the following script to connect: And frankly, it get

What additional purpose can ai_protocol serve in hints while calling getaddrinfo() when ai_socktype is already specified?

The getaddrinfo accepts struct addrinfo *hints as the third argument which can be used to specify the criteria for selecting socket addresses to be returned by this function. The documentation says that we could set ai_socktype as well as ai_protocol to specify our selection criteria. However, I am unable to understand why ai_protocol is required if we already specify ai_socktype.

2 program get same udp packets from a port

there is a server will send some UDP packets to my localhost, for example: if it send some UDP packets to my localhost and destination port is 5000. and there will have a client program to receive it on port 5000. but, what I want is to create another program, it will try to receive the same packets on port

Advertisement