Raspberry Pi broadcast serial port data to local network
- by D051P0
I didn't find anything to help me with this problem.
What I want is:
Serial device sends repeatedly some data to serial port.
Raspberry Pi should get this data from RxD and stream it to local network via port 10001 without filtering it.
So I can find this device on my pc.
This should also work in other direction:
Raspberry listen to port 10001 and forward all data from local network to TxD.
I'm newbie in Linux World.
How can I listen to some port on Raspberry Pi and send broadcast to the same port?
I'm using Raspbian Wheezy with soft float.
I have found a library Pi4j for Java, that I already use to get and write data from/to serial port.
final Serial serial = SerialFactory.createInstance();
serial.addListener(new SerialDataListener() {
public void dataReceived(SerialDataEvent event) {
forward(event.getData());
}
});
event.getData() is a String, which I want to broadcast in my local network.
Is it generally a good Idea to use Java for that?
I need also a String from port 10001, which I can forward to serial port.