Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hy guys,

I want to write a mobile device app that communicates with a PC over the internet. In order for this to work i need a server side application that both the mobile app and the PC app can connect to via sockets (why this is so it's another story). The server side app will dispatch messages that come from the mobile device to the PC and the other way around. My question is: what is the best way to implement the server side app? (It can be c# or Java). I can go with C# but i don't know what form should my app take. A windows service? Or a Java applet? I'm also clueless about what advantages these 2 can bring in the maintenance and control part. Please Help! :)
Posted

1 solution

Although I'm no expert in this, I'll throw in an opinion; I'm never short of those. I like the Windows service approach, rather than the Java applet method. My experience is that Java applets tend to be slow to respond to events, and rather unreliable in general.

A Windows service can be controlled by the host administrator, runs automatically on startup (if you choose to configure it that way), and can log activities in the Event Viewer. C# programs are also rather fast, and can be made quite efficient, as well.

Structurally, I'd design it as a base app hosting two worker threads to monitor the mobile socket and the PC socket for requests. When either thread detects a request for action, this is passed to the host app for service.

I'm trying to build something similar, though using an embedded processor rather than a Windows server, and this is the approach I plan to implement.

Just my $0.02 worth...
 
Share this answer
 
Comments
Stefan Bogdan 6-Sep-10 2:43am    
Thank you, Roger.
This is the kind of answer I was looking for. I am still a litle concerned with the acces rights app hosting services provide. I don't think i can just take my app and install it on the provider's server, log in and have my way with it. Or can I? I've never worked with such services and i don't know what to expect...

Thanks again for your answer!
Roger Wright 6-Sep-10 3:48am    
No, you can't. Access rights are a bit fuzzy to me; I usually learn about them after Windows refuses to do something I ask it to. It's a PITA, but the benefits are worth the hassle, I think. At the least, you'll want to create an account on the host for your app to use and assign it the rights you need. You'll need the cooperation of the systems admin for the hosting site to set that up. But that's not usually too hard; we geeks tend to stick together.
Stefan Bogdan 6-Sep-10 5:46am    
Thanks again for your answer, Roger. I think i'm gonna go with your advice and implement the app as a C# windows service (BTW: that was my first choice too). I'll then look for someone to host it.
Roger Wright 6-Sep-10 11:17am    
Oops. From your initial question I thought you were doing this on a server you control. I suspect that you're going to find it difficult to convince any hosting service to let you run a Windows service on their machines. But a C# web application will work just fine, and your hosting provider won't object.
Stefan Bogdan 6-Sep-10 15:29pm    
How about if I make my app a Java applet. Do you think hosting can be found more easily?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900