I'm creating a server (PHP/JS) application which is communicating with a client application (C#) over Websockets (WS). The C# application is listening to port 4001 and the server application will create for each request (in javascript) a websocket to the C# application.
In the server application it is possible for the end-user to create a new e-mail, which will be send over the websocket so the client application creates the e-mail in Outlook (using Microsoft.Office.Interop.Outlook). So far so good, everything is working fine.
I need to run this client application for each user on the remote desktop envoirment, because it's using the Microsoft.Office.Interop.Outlook libary. This is impossible, because there can only be 1 instance of the application listening to port 4001. I read on various sources that it is impossible to use Microsoft.Office.Interop.Outlook as a C# service.
My question is, how can I achieve that there is only one active instance of the client application on the server side, which can use the Microsoft.Office.Interop.Outlook libary off the current user.
Related
I have to develop a WinForms app with embedded web browser. The browser could be either WebBrowser control or WebView2. Once I supply IP address to the address line the browser starts getting data from the server (of that IP) over WebSocket. I think the browser is the one that creates the WebSocket and connects to the server.
My question is: how to I intercept the data that comes over the WebSocket from the server? Somehow I need to hookup to this web socket. Redundant to say that my code in the app is C#. I need to do some calculations on that data.
I was thinking creating my own WebSocket or Socket in C# and connecting to the server with that IP, but I am not sure if the server accepts multiple connections...
Apparently it is possible to launch a browser with the page and then create CDP session (Chrome DevTools Protocol) that allows interacting with browser API and thus intercept a WebSocket communication. CDP is the foundation for Microsoft Edge DevTools, which is now in Preview. Meanwhile CDP can be used... Alternatively, I can also use open source PuppeteerSharp library that I can get via NuGet and it gives access to CDP... Anyway, that's the direction that I will be be digging in...
I've a winform app that is connected to a sql server database and there are many pc client with the application installed. A standard desktop client/server application.
I want that a single client can communicate with all others, for example I want the administrator cand send a message to all clients. Something like SignalR fir asp.net.
I do not want that is the client that ask to database if there are messages, I want that all clients connects to a service that raise events like broadcast message or chat.
I prefer not to install something that needs a web server, but I will consider all your suggestions. Also I'd like to know if there is a specific name to this functionality so I can do a more accurate search.
thanks to all
I manage a web site for company that hired me after being unsatisfied with the original developer of the site. One function of this site is to add new patients. Part of adding the patient is to receive data from a USB port on the client machine via an applet. Since the Java 7 update 21 the applet does not work and the company has asked to remove the applet and replace it with a different solution. I am having trouble doing this, however, due to the applet listening to the client USB ports from the server to retrieve the data. I Have thought of a few ideas to solve this but am unsure if it is possible and haven't been able to find the answer online. I was hoping someone here could tell me if my idea is possible or point me in the right direction.
When the user adds a new patient the web site will call a web service on the server. This web service will then call a WCF hosted Windows Service on the client and active its serial port listener. Once the client's Windows Service has received the data the WCF will respond to the Web Service on the server and parse the data.
What I'm having trouble with is finding a way that the web service can call the WCF downloaded by the client and have it begin listening to the USB ports. If anyone could tell me how to do this, or suggest a better way to have the server initiate the client listening to the serial port I would appreciate it.
Do you have any system requirements?
When entering new patient, what kind of browsers are expected?
Will this be deployed as one solution, or clients expect that your application
can support any modern browser?
The main problem is that browsers are very restrictive in terms of what
kind of code you are allowed to execute. By default, browser won't allow
to execute any plugins / read any usb ports, let alone execution / installation
of arbitrary wcf service.
So, supposing that you have 'any modern browser' in requirements - you have following options:
Java / activex applet plugin. I believe this is the only sure-way to have access to usb
on a client machine. Also plugin must be signed with trusted certificate, or client must allow
execution of untrusted plugin (again, check requirements). I though silverlight would also
be a valid alternative, but according to my research (please correct if I am wrong) - its security
model does not allow any kind of USB access.
Prompt user to download and install browser plugin / helper object with access to usb.
And then communicate with your web page through this plugin.
Installing an entire wcf service on a client side would be an overkill in my opinion.
You would have to manage issues like firewalls, closed ports, security,
writing a self-hosting wcf solution, etc.
But if you managed to install and host a wcf service on a client side:
When the user adds a new patient the web site will call a web service on the server.
This web service will then call a WCF hosted Windows Service on the client and active its serial port listener.
Why not save a roundtrip and call client service directly from page?
Server would need to know client address to call it, which is not always possible.
Probably your web page can attempt to access localhost, at predefined port,
where your wcf service is listening.
Once the client's Windows Service has received the data the WCF
will respond to the Web Service on the server and parse the data.
It would be easier to respond on call from your web page (use polling if usb reading is slow),
and only then send to server. Browser already knows where to send data, and have permission
to do so. But if your server address is well known and can be accessed with domain name,
you can try to connect to it from your wcf on client.
Also there is a very similar topic, discussing connection to usb from client.
My server has two applications running on it:
TCP socket server that continuously accepts and sends messages to and
from clients (C# .NET Winforms)
ASP.NET application
What I need is:
When a message is received from a client via the TCP connection (app 1) I want the ASP .NET application (app 2) to reflect this data dynamically. I realise that I can set database entries via the TCP socket, which will then be picked up by the ASP.NET application.
A way of sending messages to clients from the ASP .NET application to clients that are available inside of the TCP socket server
e.g. A simple chat program where a client sends “Hi” and server responds “Welcome”. The ASP .NET should show a log of this conversation as it happens. Immediately. And if I click a button on the ASP application, it should send a message on behalf of the socket server to the client “You have been accepted onto the server”
For the most part, the messages are going to be fairly short like the ones shown here.
What is the best way to do A and B?
SignlaR is a good solution if you're getting the messages from another SignalR client (web page).
But what if these messages are being sent from a 3rd system over TCP/IP?
Then you need to open a TCP port in the ASP.NET Web Application and after receiving a message you have to push it to the web clients.
But the question is, what is the best way to have such a TCP Listener hosted in a Web Application (ASP.NET)?
if your "messages" are mostly textual, you may want to take a look at SignalR.
SignalR is a new library for asp.net to enable real-time web functionality.
It uses websockets (or long polling if websockets is unavailable at server/client).
It has support for different client types.
I have a client mobile app that needs to listen for updates from the server. But the server send the message oly to one client at once (it is not a broadcasting). How can I kep track of whom to send the message to, and send it using sockets?
should the mobile app be the server for the socket, or the asp.net server?
The mobile app should be a client. It should have unique ID (a GUID works well). The server accepts a connection from the mobile app. The mobile app then sends its unique ID, the server creates a object that stores the socket and unique ID. If 10 clients connect, you store 10 sockets each with there own unqiue ID.
Now the server has an update to push out:
Loop through your objects, sending data down each socket to the mobile apps.
p.s I do not think asp.net would work for this. But you could easily code a C# .NET app.
EDIT:
Additionally, if you were to self-host an WCF service in the C# .NET app, then you could consume the service from the ASP.NET web application. Then, this would allow you to send data from the web application to the C# app and the C# app could pass that data down to the sockets, or trigger the c# app to send certain data down the sockets to the mobile apps.