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.
Related
as the question says, how can I communicate from a rest API to Windows application. I have Windows application that connects to a linux server over TCP connection. This application manages multiple connections (around 7-8k tcp connection on different ports and keeps alive these connections all the time.). I have a mobile application that connects to rest API (APS.net C#) and works as expected. Now i want to send some more information from linux server to mobile client. How can I send a request from rest API to windows application and get response to send it to mobile application when requested from mobile. This communication between API and Windows application should be asynchronous and could handle around 7-8k connections without delay. How can i achieve this? Is it possible to achieve this using current architecture? or should I change it? I am willing to adopt any proposed architecture or new framework and any other programming language which serves the purpose good. Here is rough structure.
I think you can try using SignalR, it allows for dual communication between client and serer
It uses websockets as its underlying connection and you can either send messages to all connected clients or a specific client.
https://dotnet.microsoft.com/apps/aspnet/signalr
I am writing a notification client desktop application to be installed on multiple machines on a single network. These clients will communicate with a central windows service running on a single machine within the same network. Both the client and service are written in C#.Net. I am trying to determine what technologies or frameworks I should use for communication between the client apps and the windows service. I hope to use a push notification pattern instead of polling from the client.
So far I have looked into SignalR and WCF. WCF with NamedPipes looked promising, but I saw that a limitation of the WCF NamedPipes implementation is that it has to be on the same machine, so that won't work for me. SignalR seems like a good option, but I wasn't sure if there is another framework out there that won't require hosting a web server to support HTTP.
Any Suggestions?
You can consider MSMQ to send messages. https://msdn.microsoft.com/en-us/library/ms978430.aspx
This framework does not require anything special, as it is included with Windows. You may need to install the MSMQ as a Windows Feature. In my use it has been a pretty good utility that allows notifications and a host of other features.
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.
I am working on a windows service that acts as a medium between a web application and a standalone client side program. In a nutshell: Before submitting a form on my web application, I want it to be encrypted by my client side standalone program. The medium of communication has to be the windows service.
My question is: How do I call a C# function in my service through JS? (This function will help me relay data back and forth between the website and the standalone application)
I was successfully using an applet to act as the medium before but I have shunned that idea as many security issues are being plotted off late.
You can self host a REST based service in a Windows Service. For example using the NancyFx framework http://nancyfx.org/. You can then make an ajax call using localhost as the endpoint, this would mean that the service MUST be installed and running on any clients which access it.
Also just a query, why are you doing your own encryption client side? You can encrypt the communications to the server using SSL and then do whatever encryption you require server side. Is this some design that is being imposed on you?
Does it have to be a Windows service?
You could write a WCF service that you host inside a Windows service. There's an article on MSDN about how to do that (http://msdn.microsoft.com/en-us/library/ms733069(v=vs.110).aspx) and there are many more on the Web.
You cannot call a function defined in a Windows service directly, you have to expose it to the outside world using some kind of endpoint, like the way WCF does.
I want to send data to a driver software via browser application with in same machine. If this driver can keep on listening to external connection via socket as a windows service, can I write a web application to send data to this driver by using php, applet or .net. Driver is written in C#. Is this possible and if so can someone show me a path/suggestions or any resource related to this?
I do not know a whole lot about drivers...
But, if you can self-host a WCF service in the C# driver, than you can do IPC (inter-process communication) on the same machine. The WCF could expose multiple endpoints ie.) http, namedpipe, or tcp and the .NET web application can subscribe to the service and send data to the C# driver.
Also, if you use a http or tcp endpoint, i believe that the web application would be able to connect to the C# driver from another machine.
WCF Reference: http://msdn.microsoft.com/en-us/library/ms731082.aspx
you could use web sockets WebSocket, however your driver would have to handle the handshake.