Accessing Local Devices from Web Page/Application - silverlight

I am designing an application that requires me to access devices connected to the machine. We will have control of the machine, meaning control of the software and OS installed.
I know in the past one might suggest active-x controls, I was wondering is there a better solution? I have looked into Silverlight as an alternative, but not found much information supporting that design approach

Well, in theory, there's tcp support in Silverlight and so you could use that to talk to a local piece of software. In reality, tcp won't connect to the local machine unless you're in debug mode. So, that's a problem.
What people have been doing is creating a local WCF service and communicating with that. If you take this approach, don't forget to host up a cross-domain file as well.
I'd just add that if you can control what's on the client machine, WPF may be a much more straightforward answer :)

If you are speaking of the client's machine, Silverlight will not be of much help since it is sandboxed. In fact browsers and plugins are so locked down, that I think you should change your approach (maybe deploy your own client app, instead of using a browser/web app?)

Related

Chat *Server* on Embedded platform

I am currently building a chat server (meebo style).
The architecture is something like this.
Bitlbee over libpurple is on host B. Its a trivial server on data center.
User communicates with bitlbee via web server (just like meebo) on Host A. The backend of this web server maintains chat session. It just translates the user commands to proper bitlbee comamnd and sends back to host A.
The most important part here is that host A will be deployed in embedded Linux.
I have 2 questions.
To keep the chat session persistent I am thinking of using node.js. As its much more easier to create a real time application with persistent connection. But I doubt if its supported in such platform.
If I use C instead of node.js (I am not using any web server) I can talk to the irc server at host A by libirc. But how do I implement all the web server features in C (like session, url/cookie/post data parsing etc) ?
Also if you think my approach is wrong or there is a better approach please tell me how can I improve this architecture?
Note: This is NOT a high volume chat server.
If building V8/Node.js is prohibitive on the embedded platform, the next best thing would be to take the event loop and platform layer (libuv) and HTTP parser (http-parser) of Node, both written in C and use those as a starting point. These are the same libraries used to build Node.js so they are battle tested and will give you the performance characteristics you seek.
Ryan Dahl, author of Node.js, demonstrates exactly how to use libuv and http-parser to build an asynchronous web server in C.
Put a ZNC server between Bitlbee and the web-based IRC client. Bitlbee will think that the user has never logged out and ZNC can maintain a backlog of messages until the user connects again with the web client.
I would try to go with node.js if that is your choice, also what embedded system is it? As knowing that would help more. Also, another plus for node.js is that it does have session handling built it, but if you wanted to do it in C try and see if you can get a sqlite wrapper running on the embedded device to store the session information.
But, if possible stick to something with less work on embedded devices, feels bad to reinvent a lot of stuff or have to fiddle with compile issues for your device.

Silverlight client port check

I'm facing a problem that gives me a quite hard time ...
People having trouble to execute a program that needs specific ports to be open, sadly they don't know if its a clientside problem caused by blocked ports, of it its simply a software problem.
So I thought about making a program that checks if the user can access the provided ports, after I made the WPF application, I was thinking about having an easier access to such functionality and tried to produce a Silverlight Version.
Questions:
a.) Is there even a way to check if the user can connect to specific ports that aren't in the range of 4502 - 4534 within a silverlight application that runs as plugin in the web browser ?
b.) Is there a way to do this, even without having access to the specific server to provide a policy file?
If you trying to do it from the in-browser application that its a no. Trusted silverlight application should be able to connect to any port without restrictions.

bittorrent client within silverlight

Is it possible to make bittorrent client within silverlight, which will run in browser?
this would be unusual bittorrent client, he will download data from the server and will seed it. is it possible to do?
Is it possible to do within different, web tech, such as e.g. JavaFX?
Yes, completely possible. You can't receiving incoming connections, but that's no requirement for Bittorrent. The only thing that makes it difficult is that the peers you are connecting to need to serve a socketpolicy file on port 80 or 943, and almost none of them do. Without this policy, the Siverlight BT client will only work in the trusted 'Out of browser'-mode, which make it less usefull.
It's like a chicken-egg problem: as long as their is no large userbase for a Silverlight BT client, 'normal' nodes will not open port 943, and without that port, there never will be a large userbase for such an client.
Adobe solved this smartly by introducing Cirrus, their hosted rendezvous routing service which makes P2P possible from Flash without torrents.
No. You don't have access to the client's file system outside sandbox access.
http://betaforums.silverlight.net/forums/p/9351/29437.aspx

Protocol for remote process management

In short: Is there any known protocol for remote process management?
I have a system that contains several applications, each has it's own computer in a local network. When the applications are up and running, they communicate without any problems.
What I'm interested in is a protocol to manage the remote applications startup, shutdown and monitoring. By monitoring I mean getting error codes (predefined) when something goes wrong. Ideally I would control the whole system from one managing application and get status about what's going on.
I once worked in a place that wrote an in-house protocol that did this. However, I wish to avoid writing it again if someone already figured this out.
Edit: some more details:
Platforms in use are Windows and Linux, both on x86.
On Windows, C/C++ and .NET are used. On Linux, C/C++.
Why bother with homegrown solutions instead of using tried and tested technology? Unless you only employ programmers who are MENSA members with 30+ years of experience, your solution will be less robust and costlier to maintain.
You failed to mention any details about the platform you're using, so I'll assume a Unix-ish system. I would go with (and have been going with for years)
SNMP for monitoring
either daemontools or cron + scripting (as a distant second choice) for supervision and restart
ssh/scp with RSA authentication for interactive intervention, remote command execution, and occasional transfers

What are some ways to control a device through an IP address?

I want to get some ideas on how I might control a video camera through an IP address. I have an API to control pan and tilt from a local machine. The code is going to be in C/C++ on Windows. I am still designing if I want multiple cameras controlled from one application or have a one camera to one application. Would SOA be a useful architecture to structure my messaging?
I think you could be well served by something like REST for a task like this. Executing a command towards a REST server is really intuitive and simple, which sounds just like what you need. I'd probably make some kind of application that would be running inside a web-server, since this would handle most of the infrastructure, including authentication if needed. I'm sure both apache and IIS could do this for you quite easily. Even though your API is coded in C you could also consider using some higher-level scripting language as a client to the API (inside the web server).
SOA sounds a little overkill for a task like this.
I did something similar for aproject in my university. What we had was the cameras connected to a LAN and with message passing was very easy to communicate with them, is the same that communicate with any PC. We had the same application to communicate them. You can use SOA or any architecture you consider convinient, that depens on your application.
For our case was just an ad hoc architecture, it was not a complex thing.
Hessian is nice. It is basically REST, but has a binary protocol which is more efficient than XML and it also lets you make calls from other languages quite easily. So, you could develop the client GUI applciation in C# and the server in C. There are free libraries for a few different languages available.
http://hessian.caucho.com/

Resources