Sending raw data to Windows store app without Azure - c#

I want to build a chat application but I don't want to use WNS because WNS required a visa card. Is there any way to send and receive raw data to Windows store app without WNS?
I found Push Notifications without Azure service? but it is MPNS for Windows phone, not for windows store app.

Is there any way to send and receive raw data to Windows store app
without WNS?
You can send and receive raw data by establishing socket connection between your application and server and handle the information in foreground or background task.
To know how to use stream socket to send and receive data , please see StreamSocket Sample on GitHub.
Moreover, you can use SocketAcitivityTrigger class to register a background task to notify the socket broker when your app is not active. For the complete sample , please refer to SocketActivityStreamSocket sample, which requires the capability Private Networks (Client & Server). And if your app uses socket activity triggers, you must specify the User Notification Listener capability in the app manifest.
The sample consists of SocketActivityStreamSocket (for client side) and StreamSocketListenerServer (for server side), please note the sample scenario will not work if both apps are testing on the same machine. Be sure to run the apps on separate machine so that they can communicate with each other.

Related

Event when Remote Client is accessing Windows 10 IoT Core?

I am trying to create a sort of lockout functionality for Windows 10 IoT Core so it can be used on a local display as well as by the Windows 10 IoT Remote Client. And when the Remote Client is in use some functionality can't be used on the local display.
To do this I am just looking for a way to detect if the Remote Client is active or an event that fires when remote client begins and stops that I can use in the UWP code to be able to implement this.
Thanks!
You may try to monitor if there is a connectivity of the Remote Client. It seems that the port for Remote Client is 8000. You can use netstat command to confirm the port. ControlChannelTrigger enables real time notifications to be received in the background for objects that establish a TCP connection. You may refer to this sample.

Capture incoming packets on port opended by other application

I'm considering interfacing my application with my VOIP system. My VOIP comes with client application that registers with the VOIP server and when acall comes the app displays call info on computer's screen. I identified local port that listens to the VOIP server. I identified the packet that contains the phone number of incoming call. I identified hex position of that phone number within the packet. So now I want to listen on the Socket for a Stream and create an event when expected packet comes. There are two questions:
Will Windows allow me to listed to packets coming on a port opened by another application?
I've never written Socket listener code. Can you refer me to an example or a tutorial?
One possible solution would be to create a man-in-the-middle application:
Client Application <----> Your Application <----> VOIP Server
Your application will act as a proxy between the Client Application and the VOIP server and at the same time do whatever it wants with the data.

Windows Phone App Background HTTP Connectivity

I am working on developing a non-VoIP Windows Phone application that needs to have a background HTTP connection to be notified when new messages are received. I noticed for Windows Store apps, there is an example for ControlChannelTrigger that allows you to connect an HttpRequestMessage and will send a push notification to the app when data is returned by the http request.
Is there a similar concept that I can use for Windows Phone, because just using a Periodic Task really isn't good enough.
You cannot do that with Windows Phone. Once your app is not on the foreground anymore, there is no way for it to maintain a connection.
You should instead look into push notifications implementation here.
There was a trick where you could use a background audio agent to maintain the connection but I don't think it's still doable. And is considered a very bad practice from both a developer and a user points of view.
So you should just go with the standard push notification thing linked above.

Communication between Desktop Application and Windows Mobile Compact Framework c#

I am writing a desktop application that will have to communicate with a windows mobile application in the compact framework 3.5. The communication must occur over the internet between these two applications to send data between them on command if the connection is available.
The system will send messages and objects like Images between device and desktop application and check to see if the desktop can see the device by sending a command and have a timeout on response. (Application will then know that the device is not available).
The mobile device will send a message to the desktop application when online as well that the desktop knows that the mobile is connected(Type of registering for communication)
Can someone please inform me of the best way to follow to accomplish this.
I did some research and found this site is near to something like event based driven communication I would want but do not have the availability of setting up an email on each device.
Battery life and internet open on device is not an issue.
Should I check in on working with the System.Net.Socket class for this type of communication between the two application and if so how will I set up so firewalls will not interfere and have my desktop application be seen over the internet by the mobile application ?
Hope someone can spread some light over this for me, if you have a answer please provide a link so I can read up on it.
your description is something basic. OK, regardless of what TCP/IP communication you decide for (HTTP, sockets) you must always have your internet router forward packages on a specified incoming port to your PC and the firwall must accept these incoming requests.
So, the device will have to send data to the PC and vice versa. So you need a server and a client on the PC and on the PC.
Possibly you can use an already available cloud like Dropbox to exchange files between PC and device.
What are about your skills in socket programming? The main server (PC) must be written multithread to be able to server multiple device client requests.
A simple socket comm is done in my SocketWedge [http://www.hjgode.de/wp/2010/05/27/transmit-data-from-winmo-device-to-pc-socketwedge-and-socketsend/]. A way of multithreaded communication using a web server on the device is available here [http://www.hjgode.de/wp/2012/10/19/windows-mobile-a-simple-web-server-with-extended-features/].
Will SQL with data synchronization be a possible choice?
Can you describe the application in more detail?
~josef

Create a socket that the mobile client can listen on to get notifications

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.

Categories