Read Client side Serial Port in ASP.NET C# - c#

i need help in reading clients Serial port (COM port) from my web application.
i am able to read it on windows application but if i wants to put it over the web.
is it possible to do so?

I could be wrong, but I don't think it's possible to read a serial port (or indeed any type of port) directly from the browser because there isn't going to be any interface to the underlying system hardware, etc.
However depending on what you need to do there are a couple of options (and probably more that I haven't thought of)
Browser plugin
You could write a browser plugin that can do whatever it wants (within the limitations of a browser plugin of course) and can be used by your webpage by injecting the serial data feed into the page.
The problem with this would maybe having to create plugins for all browsers (assuming you want the web application to run on whatever browser the user chose)
Self-hosted WebAPI in a desktop app
You could embed a self-hosted Web API into either your existing desktop app or a tray application / Windows service, etc, that interfaced with the serial port as you currently do.
This app or service would read the data and "publish" it via a simple JSON-based api that your web app can GET (or could use web sockets to push the data once the initial connection is made by the web app) and could also accept commands from the web browser via POST, etc.
Your web application could then access this via HTTP to get the data and do whatever it liked with it.
Either way, I think the user is going to have to install something to their local system for this to work.

Related

Alternative solution to Java applet

I want to create an architecture as below
Web browser sends an http request. Web server accepts it and returns response to the another port to client machine. Windows service setted up at client machine will accept this reponse and process it.
I want to realize the project via Java applet. But Chrome doesn't support NPAPI. And Firefox also will terminate the support till the end of 2016. Therefore I decided to solve my problem by above way.
How can I realize it?

Read data from com port since client, web application, C#, .NET, Razor, MVC4

Good day, I created a web application using razor, mvc4 and c #, what happens is that I need to read some data traveling through a COM port on the computer, on the server it runs smoothly, the disadvantage is that I need to read the data through com but from every PC you open the application, not necessarily from Server, is it this possible ?, thank you very much.
Web browsers do not allow serial port access. And this makes sense because if a malicious web site could just read and transmit data through a client serial port, it'd be a serious security issue. There are only 2 ways to do this:
Using a rich internet technology, such as Silverlight or Flash. Both are being deprecated though.
Google Chrome has an API that you can access from Javascript. However, this solution will ONLY work on Chrome browsers.
You would have to write a browser plugin that allows access to the serial port, then each user would have to accept and install this plug in.

Client PC communication with a Host PC over LAN

Short Verstion: I have a task that I need to make an application get a computer's camera screenshots, and send to another computer running a Windows Service, in the same local network (but not connected to the internet), along with some other information.
Long Explanation: We have an application that runs in the background while the user takes a survey, and we get the user's information such as ID and we save his answers along with other information (only pictures at the moment).
We convert these pictures to data and send them to a WebService, which then saves in a server.
Now we're implementing an "offline" version of this functionality, and we're supposed to save the user's data to a specific computer in the local area network, running another application that saves these data to later upload them to the server when it's online.
Question What do I need on both PCs for this communication to work?
Is it possible to access the Windows Service in the Host PC if it doesn't have IIS installed? (It'll be a client machine so it probably won't have it).
I've been trying to google to understand what should I search/understand but I couldn't find anything that wasn't about WCF and IIS / Online services.
you need some form of communication between the 2. It could be TCP/IP sockets or WCF or classic webservices... but if it is webservices then you DO need it hosted in IIS just like WCF. But WCF allows you to not only host it in IIS but it can be self hosting in your application or you can also use the Windows Activation Services (WAS) too. TCP/IP sockets can also be a solution here. I would lean towards TCP/IP Sockets as the problem you describe is more suited for this than a full bloated service.

What technology should I use to allow my Windows Service or Web Service (written in C#) publish it's progress and status?

The requirement:
My [windows/web] service in C# 3.5 periodically has something to say about its state. It could be a progress status, log entry, error or warning, or signal of data availability.
Client applications are on the same network, and they would like to learn about some of these messages.
Clients start and stop randomly, largely outside of my control.
Clients are written in C#, C++ and even Delphi.
Database connection that can support storing my service's messages may not be available.
I would like my service to publish its messages (text-based protocol) for subscribers to be able to see and react to. I don't want to bother with how many clients are connected, or are there clients at all.
I was looking into named pipes, regular TCP/IP, semaphores, but I cannot seem to find anything that fits the bill.
Currently I'm forced to store a file on the network that is being currently updated, but it's not clean, and requires clients to have access to a network share.
Looks like you need to use WCF for this.
WCF can handle named pipes, TCP/IP and it can do windows and Web services.
You can have a look here:
http://msdn.microsoft.com/en-us/library/ms731082.aspx
Hope this helps!
Check out the OWIN project and the Kayak implementation.
It will allow you to run your own in-process web server.

Connect Windows Mobile to client PC over WIFI

What would be the best way to transfer a string across a network from a windows mobile device(so .net) to a .net app running on a pc on the same wifi network?
Would normal sockets work or would i use something like a webrequest?
The client can be any version of .net.
Thanks
For application there is no matter what type of connection is used, because it is incapsulated inside net-related classes.
On desktop you may use
TcpListener http://msdn.microsoft.com/en-us/library/system.net.sockets.tcplistener.aspx
HttpListener http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx
WCF
Web Service
ASP.NET Handler
These classes allows you to map some URL like http://{PC-name}/somepath to code executed by your applcation.
On mobile device you may use some classes allows you to make request using that URL. Also if your desktop application publish web service or WCF service, you may add reference to this service to mobile application and get strongly-typed interface to operate with desktop application. It is preferred way as for me.

Categories

Resources