Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to get Remote Machine's hardware resources

How to get Remote Machine's hardware resources

Scheduled Pinned Locked Moved C#
tutorialhardwarehelpquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zinc_z
    wrote on last edited by
    #1

    Hi , I want to access remote machines hardware , like CD-ROM Drive , WebCam etc. But I am not sure where to look and frm where to start. So can any one plz guide me to right direction ? I am using sockets to access remote machine , so I am assuming streams are only way to get these hardware resourses , but how ? Need help , thanks. ZINK

    S 1 Reply Last reply
    0
    • Z zinc_z

      Hi , I want to access remote machines hardware , like CD-ROM Drive , WebCam etc. But I am not sure where to look and frm where to start. So can any one plz guide me to right direction ? I am using sockets to access remote machine , so I am assuming streams are only way to get these hardware resourses , but how ? Need help , thanks. ZINK

      S Offline
      S Offline
      Shy Agam
      wrote on last edited by
      #2

      This can be done in a few ways, and this is one of them (not necessarily the best): Use System.IO.DriveInfo.GetDrives() to retreive all drives, then use a formatter to serialize the DriveInfo objects to the NetworkStream. As for webcam and other devices, you're gonna have to code API wrapper classes, mark them as Serializable, and again, use a formatter to serialize them to the NetworkStream. Regards, Shy.

      Z 1 Reply Last reply
      0
      • S Shy Agam

        This can be done in a few ways, and this is one of them (not necessarily the best): Use System.IO.DriveInfo.GetDrives() to retreive all drives, then use a formatter to serialize the DriveInfo objects to the NetworkStream. As for webcam and other devices, you're gonna have to code API wrapper classes, mark them as Serializable, and again, use a formatter to serialize them to the NetworkStream. Regards, Shy.

        Z Offline
        Z Offline
        zinc_z
        wrote on last edited by
        #3

        Hi , Shy Thanx for your reply. Actually I dont want to get just the Devices name , but the actual device when u share your CD rom drive on netwrok , any one on netwrok can use ur drive and access th CD data in that CD rom drive. So I want something like that . Any sugestions ? Thanks ZINK

        S 1 Reply Last reply
        0
        • Z zinc_z

          Hi , Shy Thanx for your reply. Actually I dont want to get just the Devices name , but the actual device when u share your CD rom drive on netwrok , any one on netwrok can use ur drive and access th CD data in that CD rom drive. So I want something like that . Any sugestions ? Thanks ZINK

          S Offline
          S Offline
          Shy Agam
          wrote on last edited by
          #4

          AFAIK, sharing devices over the internet is impossible. Sharing them accross network computers IS. However, I don't know how to make a device shared using code... You would probably need to find the API function appropriate for the job. Search CodeProject for articles, or google it... :) Good luck, Shy. Added: If, however, you want to enable browsing and controling of hardware devices over the internet, you would have to write a client-server application, in which the server sends information to the client regarding the devices, the client sends requests for information, and requests for execution of stuff (creating directories, deleting files, etc.), and so on... You would have to design you're own protocol I guess.

          Z 1 Reply Last reply
          0
          • S Shy Agam

            AFAIK, sharing devices over the internet is impossible. Sharing them accross network computers IS. However, I don't know how to make a device shared using code... You would probably need to find the API function appropriate for the job. Search CodeProject for articles, or google it... :) Good luck, Shy. Added: If, however, you want to enable browsing and controling of hardware devices over the internet, you would have to write a client-server application, in which the server sends information to the client regarding the devices, the client sends requests for information, and requests for execution of stuff (creating directories, deleting files, etc.), and so on... You would have to design you're own protocol I guess.

            Z Offline
            Z Offline
            zinc_z
            wrote on last edited by
            #5

            HI Shy , Thanks for your reply. Yeh I have socket application runing on client and server. And I want that when client want to access data on cd on Server's CD Drive , server reads that data and send to client . But not sure how to do this ??? Regards, ZINK

            S 1 Reply Last reply
            0
            • Z zinc_z

              HI Shy , Thanks for your reply. Yeh I have socket application runing on client and server. And I want that when client want to access data on cd on Server's CD Drive , server reads that data and send to client . But not sure how to do this ??? Regards, ZINK

              S Offline
              S Offline
              Shy Agam
              wrote on last edited by
              #6

              Well... That's a much bigger issue... These are stuff you need to figure out on your own. :) Search for articles and code exemples to get the idea... Here are a few ideas and guidelines: - You can use .NET Remoting to use objects from the server on you client. This will release you from the need of designing an entire protocol. You would simply instantiate an object and use it as if it was an object instantiated on the client's side. So find material on .NET Remoting! - If you intend to use serialization, here are a few ideas: Lets say the client wants to receive a list of the directories in drive c:. You can create a class which will hold the requested path, like so:

              [Serializable]
              class DirectoryListRequest
              {
                  private string pathToExplore;
              
                  ...
              }
              

              Then you instantiate an object of type DirectoryListRequest and serialize it to your NetworkStream. The server then deserializes it, reads the pathToExplore field and instantiates its own object of type DirectoryListReply. Then the server serializes the DirectoryListReply object to the NetworkStream, and the client deserializes it, and so on... Good luck, Shy.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups