Serial Port to redirect sockets RRS feed

  • Question

  • hello,

    my program communicates with a device "A" owner through the serial port (SerialPort C #). Today the same program needs to communicate with a device "B" via Ethernet; the latter will communicate via the serial port with the device "A". Is it possible to replace in my program the SerialPort write and read method so as to communicate with the device via Ethernet ?


    Sunday, October 11, 2015 7:19 AM


  • I think that if you should redesign your transfer functions to take a Stream object, and maybe use helper classes such as StreamWriter, etc. Then you can pass the BaseStream member of SerialPort.

    In this case you will be able to use other communication methods. For example, the NetworkStream class will allow transferring the data via sockets using your existing stream-based functions.

    Sunday, October 11, 2015 11:34 AM