Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 521869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:17:42+00:00 2026-05-13T08:17:42+00:00

I have a need to write an client-server application where a tiny server rests

  • 0

I have a need to write an client-server application where a tiny server rests on a USB gadget and communicates with a client application on the host.

I’ve not done this sort of thing before but I have done webapps and usually, they’re all developed and debugged on the local machine using the lo loopback network interface. This has perhaps influenced my way of thinking and I’m looking for a way to simulate a USB host and gadget on my machine so that I can build both ends of the application completely on my PC before I dive into the actual gadget and get the thing going.

Is this the right way to go about it? I realise that the USB protocol is asymmetrical and found some references to this over here but it seems to most natural way to go about it.

If it is the right way, how do I start off with something like this and are there any potential problems that others are aware of which I might stumble over?

Update

References which I found from Googling earlier. There are Linux Kernel modules (part of my Ubuntu Install too) which seem to be able to simulate the host and gadget sides (viz. dummy_hcd and gadgetfs respectively). My idea is to simply have something like

Host application (client) on PC <-> device file 0 <-> Loopback device <-> device file 1 <-> Gadget application (server) also on PC (will be moved to gadget).
  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:17:42+00:00Added an answer on May 13, 2026 at 8:17 am

    Don’t over-think it.

    You don’t need to fancy “loopback” device.

    You’re right about simulating the USB host. You don’t need to create a fancy USB loopback device or any silliness like that.

    1. Design your client.

    2. Design a “generic” USB interface layer that would simply passes requests to a real USB device driver. Don’t code this yet.

    3. Code a USB interface layer that mocks the host instead of using the real USB device.
      This has the same interface as your generic USB interface. It’s a proper subclass.
      However, it doesn’t actually use the USB device driver. Instead it acts like it’s the
      web server on the USB device.

      Clearly, it’s not a complete simulation. It’s just enough for you to test your client.
      Each key feature that the client must interact with is represented with enough canned
      responses that you’re sure the client works.

    4. When your client works, code the real USB interface layer that really passes requests
      from client to device. This is that you’ll use in production and to do integration
      tests with the real USB device.

    Your client software now has two configurations — all handled in software:

    • The real driver — for production.

    • The mock driver — for unit testing.

    It shouldn’t be any more complex than this. And, you can now unit test your entire client using your mock host.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a file transfer application between (client-server) and have the tools I need
I need to write a client-server application. I want to write it in python,
I have Chat Client Server Application, which we are scaling up. so I need
I have a need to write a GTK application in C that does some
I need to write a standalone Java application which will have a embedded HTTP
My scenario is as follows: I have a client-server application. The client is deployed
I need to write a Java client application which, when given the below URL,
On the server application, I need to assign to each connected client an unique
I have the following web server class found here . I need to write
I'm writing a small business application and I need to write a simple server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.