Using netcat, I need to create a simple server to respond with simple JSON data.
First I am trying with an HTML page:
while true ; do nc -l 8888 < index.html ; done
or even more simply:
netcat -l 8888 < index.html
And then in my browser I do this:
http://localhost:8888/index.html
I also try to connect using netcat:
nc -vz 127.0.0.1 8888
Each of these yields a 'connection refused' result:
localhost [127.0.0.1] 8888 (ddi-tcp-1): Connection refused
How do I resolve this error?
The problem was resolved.
I had to use
netcat -l -p 8888 < index.html
This way I can listen to a localport. Now I it is working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With