USBIP C library 0.7.0
Virtual USB devices & host drivers over USB/IP
Loading...
Searching...
No Matches
Going remote

The transport is local by default; going remote is one argument at each end.

On the device side, listen where the client can reach you: usbip_transport(NULL, 3240) (or "0.0.0.0") binds every interface, while "127.0.0.1" binds only the loopback, which a remote client can never reach. Open TCP 3240 in the firewall.

usb_transport *transport = usbip_transport(NULL, 3240);
usbip_device_plug(dev, transport); // serve on the network
int usbip_device_plug(usbip_device *dev, usb_transport *transport)
Plug the device onto a transport and start serving it.
struct usb_transport usb_transport
Opaque handle to a USB/IP transport (the wire under host/device calls).
Definition usbip.h:494
usb_transport * usbip_transport(const char *host, int port)
Create a real USB/IP transport over TCP.

On the host side, point the context at the serving machine:

usb_transport *transport = usbip_transport("10.0.0.5", 3240);
usbip_host_set_transport(ctx, transport);
int usbip_host_set_transport(usbip_host_context *ctx, usb_transport *transport)
Bind a USB/IP transport to the context - the only USB/IP-aware call.

An OS importer attaches the same way from anywhere: usbip attach -r <server-ip> -b 1-1 (USB/IP clients).

Speed declarations, isochronous pacing and the latency cost of a network round trip per transfer are covered in Hardware clients.