I have developed a Windows Phone application that uses camera to take pictures every second. Now I want to send these images to my Windows desktop application.
Besides images, I'm planing to send GPS data and other sensors' data to my Windows desktop application in the future.
I believe I can use System.Net.Sockets.Socket, but what I get from Socket is byte[], I don't know which part of the array is an image and which part is the next image. I need special coding.
Are there object-oriented ways to send data? Does .net remoting and WCF work on WP? What's your suggestion?
The target Windows Phone OS version can be 8 or 8.1.
Don't reinvent the wheel. Opening a socket in this case is just about the same as starting a self-hosted http server, except with the http server all your problems are solved.
While with sockets, you have a lot of protocol and headaches to solve, with the HttpServer you got a ton of proven and tested code at your back, helping you solve your problem faster, plus everyone knows Http, so it's also easier to understand and maintain.
One way could be to roll up a Self-hosted Web API
Related
Looked for a long time and didn't find anything that showed this, so I apologize in advance I missed something.
I have an android app running on KitKat (Android 4.4.2) and a Winforms application running Windows 7. I need to send messages between the two of them.
Clearly GCM works to get the message to the Android device. I have code that sends from Winforms to the Android Device using GCM. I cannot find a way to have the Android App send anything BACK though. Is it possible to have a Winforms app RECEIVE a GCM Message? Do I have to use Azure? (All examples there seem to focus on the Windows App store and Windows 8.1 neither one of which can be a solution in this case due to client restraints.)
I'm putting this here in case anyone stumbles across it and has a similar question. This is not really an answer. Still hoping someone comes on here and shows that I am wrong. But after 26 days, no one has even offered a suggestion, so I'm guessing not.
There is no way that I have seen that allows for this the way I had hoped. Windows 7 doesn't have this built in to it (AFAIK). Windows 10 should have it built in, but Windows 7 pre-dates the huge shift to the cloud, and didn't have it in the design. If I were working with something like Xamarin -- which is a cross-platform tool, this might be possible. But there is no concept in Windows 7 for receiving messages from the Cloud.
In order to accomplish this, there would have to be some sort of server added to the mix that could take messages and pass them along via a REST API. This is beyond the scope of what I wanted to code.
The solution I found, and that works for me, is to use Microsofts API that wraps a REST service. This allows for communication to OneDrive, for example. That is what I am using as my intermediary REST server.
Microsoft LIVE SDK
This has a pretty good sample list of Android examples, and can be used for what I need. The good thing is the Upstream is just a simple call, and I don't need to have the Android device poll anything (which kills the battery). The laptop will need to poll OneDrive, but its plugged in so there is no battery life concern.
One thing to be aware of, though, is that Microsoft sort of hints that they don't want a bunch of traffic headed to OneDrive. This is from the overview doc:
Throttling
OneDrive has limits in place to make sure that individuals and apps do
not adversely affect the experience of other users. When an activity
exceeds OneDrive's limits, API requests will be rejected for a period
of time. OneDrive may also return a Retry-After header with the number
of seconds your app should wait before sending more requests.
Although, I have never seen what those limits actually are, so YMMV.
I've got some piece of hardware that uses ModbusRTU. Using a TCP/IP Gateway for ModbusRTU I can now control the hardware using my C# application over TCP/IP. This works.
Now I would like to control it with my android phone.
Yes, I could make an Android app, what should be no problem for me, but I want to make it more special for myself to fix it with the web browser. That way I'm even more flexible since other OS's should be no problem too.
I'm interested where I should start looking if I want to control the hardware by using the web browser. What programming language, what are the server requirements.
Please mind that I've have very little experience with web browser programming but I'm eager to learn it. Did just some very simple things with PHP / Ajax.
Fyi, the ModbusTCP packeds are really simple, I only control some lights on/off/dimming at my home and to enable some equipment.
I am currently playing with the Marmalade Quick beta which can open a TCP port in Lua. This is a simple high level language, with a build system for Android.
http://quick-docs.madewithmarmalade.com/
Which Modbus lighting controller are you using?
My goal is to run flash locally on a Windows Surface RT tablet. From research, I have found that for websites to run flash, they have to be whitelisted on Microsoft's website. Through further research, I have found how to hack the whitelist to add any domain:
http://www.redmondpie.com/how-to-enable-flash-for-any-site-in-windows-8-rt-metro-internet-explorer-10/.
However, I cannot add the local file system (i.e. C:\ or file:\\) as they are not domains. One solution, I have though of is by using localhost. How can I write a web server to run on Windows 8 Surface RT, or can it be done?
In C#, I know you can use System.Net.HttpListener: http://www.codehosting.net/blog/BlogEngine/post/Simple-C-Web-Server.aspx. Is System.Net.HttpListener supported with Surface RT? If not, what are alternative solutions to play flash locally?
Theoretically, it is possible. You need to use StreamSocketListener to get a StreamSocket. Then you handle http input from that socket (tons of work), and send back your response. I've made my protocol work. One thing you might need to pay attention is that you might need a second machine to send the http request. I use IE from another PC to send the test request. Win8 network isolation won't allow tcp connections between 2 apps of a same machine...
I'm developing a little application which will connect to a remote machine, and return to the client a list of the remote's desktop icons.
I currently have this functionality working for local desktop icons.
In theory, I would assume I'd have to give the remote server the code I used to get the icons locally, and then send a command to the server to trigger it to run said method. Then I would return it's return value back to the client for further processing / display.
What sort of objects / architectures should I be looking at to accomplish such a thing? Would I have a switch on the server to go through various different command possibilities? Couldn't this get out of hand in very large applications? How would I send a "Shortcut" object as a byte stream to the client and then re-create the "Shortcut" on the client?
Implementing remote desktop functionality is not necessary the easiest exercise to learn networking.
To start it may be easier to implement console application redirection or even simple telnet client (you can enable telnet on some versions of Windows to play with without writing server side portion).
If want to learn about how remote desktop could be implemented consider reading about Unix implementation of it X Window System.
As for graphic UI support - read on RDP, or read articles about FogCreek's CoPilot (which implements almost exactly what you want) - CoPilot technical info, or start with list Comparison of remote desktop software to find more info.
I'm looking for some input on my current project architecture. There are three components: Server, Desktop, and Mobile Device.
I have 2 goals:
1) Send data (Approx. no more than 100 KB of text) from the Desktop (multi platform client application running on windows XP/Vista/7, and Mac OS X) to a server (Windows Server 2008, IIS 7, WCF RESTful service) to save in a database (Sql Server). The services need to be scalable because the number of desktop devices and frequency they send data is unknown.
2) A service to retrieve data from the database (Sql Server) and send to a mobile device(Iphone and Android application. Message size no more than 100 KB of text). Service needs to be scalable because number of mobile devices and frequency they connect is unknown.
My proposed solution:
Server Side (Sql Server and Windows Server 2008):
I'm looking at a WCF RESTful JSON services to communicate with Desktop App(s) and Mobile App(s). I like WCF because I am most proficient in C#, have some experience implementing WCF, after doing some research it appears all technologies used for the platforms(Windows XP/Vista/7 and Mac OS X) can easily communicate with the WCF RESTful service.
Any high level fundamental issues with the WCF service in this scenario?
I have only implemented WCF on a Windows Server 2003 machine with ~800 devices connecting every 15 minutes. The server was a physical in house server running on a private network. I need this solution to be hosted and scalable. Any recommendations for hosting a Windows Server 2008? Is there a better technology to host the service? (I'm not very familiar with how the cloud stuff works)
The services will be saving and retrieving data from a SQL server. I would like to use LINQ to SQL as my data access layer. It's my understanding there are large licensing fees tied to SQL server so I may need to go with SQL Server Express for now.
I'd prefer to keep the WCF services and database hosted separately (2 diff machines). Any recommendations for hosting sql server(or express)? Is there a hosting service that can scale better for my database? Does it make sense to keep these on 2 diff machines?
Desktop (Client Side)
I am required to develop for Windows XP/Vista/7 and Mac OS X. I plan to write a .net application to run on the windows machine(s). I"m still up in the air if i'm going to write (and learn :P) XCode or try mono. Any cross-platform ideas?
Should I expect to have any fundamental problems getting the desktop applications to talk to my WCF RESTful services?
Mobile Applicaitons
I am required to developer for the IPhone and Android. There are many examples of making WCF RESTful service calls using Objective C and the Android SDK. I'm considering trying a cross platform (ie. Appcelerator). From a high level it appears these mobile cross platforms have built a Java script layer that works with both IPhone and Android!
Any thoughts on using the cross platform technology to write ONE mobile app to run on IPhone and Android?
Any fundamental issues calling the WCF RESTful service in javascript?
Sorry for the somewhat long post. I have never designed a solution of this size. All feedback is appreciated.
Thank you!
As you are clearly wanting to use Microsoft technologies - the suggestions about Mono probably make sense to you and will certainly make things easier.
However I think you may find that you compromise elements of the user experience for Mac and iPhone users which is not ideal as these users tend to have the highest expectations for great user experiences.
I understand that we don't live in an ideal world but if we did you would develop a separate client for each platform - optimised to the needs of each platform. Unless you application is doing a lot of data manipulation the data layer is now abstracted to the server viw your JSON interface so you will not gain much from sharing the data objects across implementations.
As it seems you are implementing the project in a small team (yourself?) then I would suggest that you look at implementing a web solution with the HTML javascript communicating with the server over JSON.
The other option is that you use a flex/air client on windows and mac and flash on the android and Adobe's solution to compile flex/air into iPhone code.
Good luck though.
For your client side you may consider using Appclerator because it will run on all of the platforms that you need with little to no extra code, and it is designed to be used for web app type applications
You should consider MonoTouch for the iphone. You'll be able to share much of the desktop code. I would use Mono on the Mac for the same reason. Android is the odd man out. Eventually someone might create something like MonoTouch for Android but not soon enough to help you out.