Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I would like to communicate with a USB device attached to a client system via Internet,
I have to connect to the port the device is connected to on the client side, and then invoke the execution of a function on my side,
So in a scence I need to communicate with that USB device without having any code on the client were it is attached to,
The code of the USB device is provided by its manufacturer(I just use the library), but it cannot reside on the client machine because of confidentiality,

What I have tried:

C#
public void ConnectRemoteDevice()
{
    SerialPort mySerialPort = new SerialPort("COM10");
    mySerialPort.BaudRate = 9600;
    mySerialPort.ErrorReceived += DataReceivedHandler;
    mySerialPort.Parity = Parity.None;
    mySerialPort.StopBits = StopBits.One;
    mySerialPort.DataBits = 8;
    mySerialPort.Handshake = Handshake.None;
    mySerialPort.DataReceived += DataReceivedHandler;
    mySerialPort.Open();
    mySerialPort.ReadExisting();
    mySerialPort.Close();
}

private void DataReceivedHandler(object sender, SerialErrorReceivedEventArgs e)
{
    SerialPort sp = (SerialPort)sender;
    string indata = sp.ReadExisting();
    Debug.Print("Data Received:");
    Debug.Print(indata);
    GetMeasure();
}
public string GetMeasure()
{
    //the code to trigger the USB device and get the data from it
}
Posted
Updated 19-Apr-18 6:41am
Comments
Richard MacCutchan 19-Apr-18 10:07am    
I think you will need an agent on the client to access the device.

Would you want services accessing your USB devices? Of course this isn't possible.
 
Share this answer
 
By principle, a remote server don't have access to a PC if user don't cooperate.
Cooperation can be HDD or printer sharing, but you need credentials.
Cooperation can be client opening a web app from server, it open access to cam, but only if client allow it.
In order to expose the cam to web app and remote server, you need to have a special driver and you will need the same kind of driver for your usb device.
Quote:
The code of the USB device is provided by its manufacturer(I just use the library), but it cannot reside on the client machine because of confidentiality,

A driver for the usb device must be on client PC, no matter what.
If client don't install specific software to expose the device to outside, your remote server will not have access to the device.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900