How to get Remote Machine's hardware resources
-
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
-
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
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 theDriveInfo
objects to theNetworkStream
. As for webcam and other devices, you're gonna have to code API wrapper classes, mark them asSerializable
, and again, use a formatter to serialize them to theNetworkStream
. Regards, Shy. -
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 theDriveInfo
objects to theNetworkStream
. As for webcam and other devices, you're gonna have to code API wrapper classes, mark them asSerializable
, and again, use a formatter to serialize them to theNetworkStream
. Regards, Shy.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
-
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
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.
-
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.
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
-
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
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 yourNetworkStream
. The server then deserializes it, reads thepathToExplore
field and instantiates its own object of typeDirectoryListReply
. Then the server serializes theDirectoryListReply
object to theNetworkStream
, and the client deserializes it, and so on... Good luck, Shy.