I'm looking at adding synch functionality to one of my C# applications. The intention is that 1 of the synch options is allowing one version of the app to synch to another version of the app via a USB cable.
The app is cross platform and implemented on Windows and Mac right now using Mono but will ultimately be ported to iOS and Android too.
All I want to do is send and receive data over a USB cable.
Does this sound like something that is feasible?
Feasible? Sure. It's just a serial data transfer. You'll have to deal with the opening and closing of ports and the sending/receiving of data, but it's very straightforward.
public void SendDataOverSerial(string data) {
try {
SerialPort port = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
port.Open();
port.Write(data);
}
finally {
port.Close();
}
}
Obviously you would need something on the other end of the pipe that received the data and did whatever it is that it should do with it.