Relative Content

Tag Archive for c++socketstcp

C socket program stuck at listen()

I am trying to learn socket programming in C and i was trying to setup a basic TCP connection between client and server however in my server.c my code is seemingly just stuck at listen(). It does not execute the next lines and it also doesnt return the error message.

.exe file for TCP connection works in any debugger environment but not on its own

I am working in C# with VS2022. I am trying to create a TCP connection with another device, so I wrote a simple program by copying the code for the client creation from this example and substituting the IpAddress and port number with the ones of my device. The device can be pinged and I made all the checks to ensure it is listening on the port.

How can I force a socket to send data or close after airplane mode?

I have a C++ application on an IOT device that connects to a server over a TCP socket. The IOT device can be put into airplane mode, lose signal, etc. When this happens, my socket (as reported by netstat) still shows as ESTABLISHED. When my application writes to this socket via send(), everything from the application’s perspective is fine (no error codes). However, I see the send-Q growing in netstat.

Socket connection after airplane mode toggle

I have a C++ application on an IOT device that connects to a server over a TCP socket. The IOT device can be put into airplane mode, lose signal, etc. When this happens, my socket (as reported by netstat) still shows as ESTABLISHED. When my application writes to this socket via send(), everything from the application’s perspective is fine (no error codes). However, I see the send-Q growing in netstat.

TCP socket programming, uploading and downloading jpg files in C

I have a problem that if I play this program, the connection between client and server has been successful. But after that, when we try the client to upload or download jpg file from server, there is some problem. I guess there is some while statement going forever.

RST not sent or received in C with socket

I am trying to receive the RST packets sent to my program after I send several SYN packet to a closed port, the case is I am seeing any RST segments being sent or received, as I confirmed this through Wireshark.
Here is the SYN segment configuration:
` char packet[BUF_SIZE];
struct iphdr* ip_h = (struct iphdr*) packet;
struct tcphdr* tcp_h = (struct tcphdr*) (packet + sizeof(struct iphdr));