Connect to Windows app with WebRequest - c#

Is it possible for a windows mobile phone to use WebRequest to connect to a windows client application. I mean an actual windows forms application.
I want to use webrequest but the client application cannot be a web app or anything, it has to be a windows forms program. So, is it possible?
Thanks

Possible, yes. Easy, or a good idea for that matter, no.
If your WinForms app also opens up a Socket and listens for requests on port 80.
Essentially you have to build a web server into your WinForms application and then deal with firewall and security issues of the traffic getting from the Mobile Phone to the computer running your application.

Related

Communication channel between a windows app and UWP app

I have a uwp project and a windows app (net5).
Both are installed in the same machine (same will happen in production), but the uwp is installed using sideloading, not on windows store.
The windows app gets some data by listening to a wss port. I have to pass those data from the windows app to the uwp app and also wait for a response back from it.
To do this internal communication I came across the AppServiceBridgeSamples in this repo https://github.com/microsoft/DesktopBridgeToUWP-Samples but it is outdated and I can't use it.
Is there any alternatives to it? What would be the easiest implementation to achieve this?
Any suggestions/comments are appreciated.
Currently, the general way to implement a communication channel between a UWP app and a windows app is by using App service. This is not outdated. If you don't want to use the App service, you have to build your own socket server so that both of your apps could communicate with it. Another way is that your windows app could save the data in a local file and load them in the UWP app.

Capture Keyboard events with an ASP.NET MVC application from the server PC

I have an ASP.NET MVC application hosted on a Windows 10 machine via IIS Express and I want to be able to capture keyboard strokes on the server computer (not the client side from the web browser window but the server itself).
I tried MouseKeyHook library which works fine on global events on Winforms projects but not in ASP.NET MVC projects. Is there any other way to do this?
Update:
I ended up self hosting the web app from a console app and IIS Express and then configured the barcode reader to work as Serial USB device rather than a HID Keyboard, SerialPort object is used to communicate with it, much faster and more elegant than keyboard strokes.
In my opinion, there is no way to fulfill your requirements. iis or windows service application can not capture user interaction. no matter it is a mouse click or keyboard interaction.its not allowed.

Invoking desktop app from Windows Store app

I have a Windows form desktop application developed using c#. I want to make use of the live tile feature available in WinRT apps (especially for Windows 10). The data in the live tile is to be fetched using WMI queries (Win32_LogicalDisk).
How do I accomplish this? I don't want to rewrite the entire app. Live tiles should update on the background and on clicking the tile, my desktop app exe needs to be invoked. Is it possible to fetch WMI data and invoke exe from Windows Store apps?
I tried using Brokered Windows Runtime components as given in http://blogs.msdn.com/b/dmx/archive/2014/04/30/how-to-trigger-a-desktop-process-from-windows-store-apps-the-easy-way-using-the-brand-new-visual-studio-templates.aspx . But could not get it to work as I get a 'TypeLoadException'.
Thanks in advance.
Metro app can't run a desktop app. However, they can commumicate using wcf. So, you can create tiny windows service that will open wcf host. Then you create windows store app with your live tile(s). When windows service recieves a wcf call, it starts the desktop application.
There is also devexpress' solution that is capable of adding live tiles for desktop apps, however it is not free: https://www.devexpress.com/Products/NET/Controls/WinForms/Live-Tile-Manager/
WinRT blocks network loopback so wcf won't work. You can disable this for testing but I suspect that won't satisfy you. Read more here (and search for WinRT network loopback to find articles on this topic).
https://msdn.microsoft.com/en-us/library/windows/apps/Hh780593.aspx

Converting a C# app using long poll to use Websockets on windows 7

I have an existing desktop application that uses long polling to receive notifications to use websockets. My development is on Windows 7 I have a websocket server running out on our network. When I would like to replace the notifications to use websockets, and this only needs to be a listen only.
I everything I find says websockets are only available on Windows 8.
Is there no way to create a listen only websocket connection to an existing web socket server?
If windows 8 is only development, can it be build on windows 8 then deployed to a Windows 7?
Is there a work around that does not involve third party installation?
I am afraid not. System.Net.WebSockets is not supported on Windows 7. So if you try to run an application that uses that namespace, no matter if it is server or client, it will throw a PlatformNotSupportedException.
You will need to install a third party client to be able of connecting to a WebSocket server.
Take a look at
https://github.com/sta/websocket-sharp
https://github.com/Olivine-Labs/Alchemy-Websockets-Client-Library
http://websocket4net.codeplex.com/

Testing Socket Programming in C# on Windows Mobile 6 Emulator

I need to develop and test an application in Windows Mobile 6 for socket Programming in c#. I have done it in Windows Desktop application (i.e Creating a Windows Console Application that acts as a Server and listens. Then a Windows Form Application that is the client. Has a button and textbox. When i press the button the client gets connected to the server).
Now i have no idea how to check socket programming in windows Mobile 6. (Building a WM6 application that acts as a client and another that acts as sever something like that or should i be using a different approach? I am clueless)
Thanks.
If you just want to test your Windows Mobile 6 client then you can simply connect it to your Windows Desktop application. Click on File > Configure > Network and check the Enable NE2000 option. You can see this blog post to find out how to install the NE2000 driver.
Using Windows Mobile 6 as a client and Windows Desktop as the server is fine. If you want to use the sockets over GPRS or CDMA then you should be aware of the fact your mobile device will likely have a dynamic IP (which can change as the handheld roams to other wireless networks) and will be behind NAT, so it can be difficult to push data out to the handheld without some kind of connection to the server initiated by the client.

Categories