I have a process that listens on an
IP:port - in fact it is spark streaming which connects to a socket. The issue is that I wish to somehow create a server that connects to spark on one port and data is streamed into this server from another port.
For example, the spark streaming example uses the netcat utility (for example
nc -lk 5005). However, I have another service that listens for incoming messages and then spit out a message. So I need some kind of server that can listen to messages from service A and pass them to spark.
My service A, relies on sockets. And my spark consumer relies on sockets.
Here is what I have done so far is the forwarding from port to port but this does not seem to work:
nc -X 4 -x 127.0.0.1:5005 localhost 5006
With the idea that the service
A:5005 -> socket ->
5006 -> Spark
I cannot seem to find the correct way to make this work.
Some answers have suggested the following:
socat tcp-l:5005,fork,reuseaddr tcp:127.0.0.1:5006
My spark socket reciever doesn't or cannot seem to connect. I get the error:
Error connecting to 127.0.0.1:5006 - java.net.ConnectException: Connection refused