Click here to Skip to main content
15,868,113 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello I was wondering are there cases when could be better to use non-blocking client socket on server with only one client, or select, poll or epoll system calls?
I must write tcp server and client which will handle open connection as often as possible, because I decide this will be the simplest way to found connection drop.

What I have tried:

I tried some standard non blocking socket implementation with timeout on receive .
Posted
Updated 6-Nov-22 9:02am

1 solution

Not entirely sure I fully understand the question.
Simplest web server I know of is as follows.

Bash
#!/bin/bash
# from https://www.digitalocean.com/community/tutorials/how-to-use-netcat-to-establish-and-test-tcp-and-udp-connections-on-a-vps

while true; 
do 
        printf 'HTTP/1.1 200 OK\n\n%s' "$(cat index.html)" | netcat -l 8888; 
done
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900