-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please include a fully working example #5
Comments
Yes it would. Do you have a small example in mind which is rather self-contained and still useful? I was thinking about something where you had a database connection, but it easily ends up being large and contrived for an example. So I am all for it, but I do think we should figure out what a good example would comprise. |
@jlouis use a simple thing like a dumb web server: $ while true ; do echo -e "HTTP/1.1 200 OK\r\nConnection:close\r\nContent-Length: ${#$(date)}\r\n\r\n$(date)" | nc -l -p 8081 ; done (I use that to test dumb proxying/load-balancing modes here). Put HTTP calls to For the fun of it, boot a second server on 8082, and have them output their name or something. Consider this to be switching from 'primary to replica' or from 'geographically close to in another datacenter" as a failover. Trigger the switch on failure, or by putting sleep time in the first server to simulate overload (and long time to respond). |
Thank you @ferd for the example, I tried to run here and an error happened: bash-5.2$ while true ; do echo -e "HTTP/1.1 200 OK\r\nConnection:close\r\nContent-Length: ${#$(date)}\r\n\r\n$(date)" | nc -l -p 8081 ; done
bash: HTTP/1.1 200 OK\r\nConnection:close\r\nContent-Length: ${#$(date)}\r\n\r\n$(date): bad substitution
nc: missing port with option -l
usage: nc [-46AacCDdEFhklMnOortUuvz] [-K tc] [-b boundif] [-i interval] [-p source_port]
[--apple-recv-anyif] [--apple-awdl-unres]
[--apple-boundif ifbound]
[--apple-no-cellular] [--apple-no-expensive]
[--apple-no-flowadv] [--apple-tcp-timeout conntimo]
[--apple-tcp-keepalive keepidle] [--apple-tcp-keepintvl keepintvl]
[--apple-tcp-keepcnt keepcnt] [--apple-tclass tclass]
[--tcp-adp-rtimo num_probes] [--apple-intcoproc-allow]
[--apple-tcp-adp-wtimo num_probes]
[--setsockopt-later] [--apple-no-connectx]
[--apple-delegate-pid pid] [--apple-delegate-uuid uuid]
[--apple-kao] [--apple-ext-bk-idle]
[--apple-netsvctype svc] [---apple-nowakefromsleep]
[--apple-notify-ack] [--apple-sockev]
[--apple-tos tos] [--apple-tos-cmsg]
[-s source_ip_address] [-w timeout] [-X proxy_version]
[-x proxy_address[:port]] [hostname] [port[s]] I am able to run with this example: while true ; do echo -e "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length: $(date | wc -c)\r\n\r\n$(date)" | nc -l 8081 ; done
@edescourtis I created this example using |
Would it be possible to include a complete example(s) as source?
The text was updated successfully, but these errors were encountered: