Reputation: 3809
So the goal is that the tablet can read and write a value of the PC program.
So far I have managed to solve this.
I have :
an android app which uses ksoap2.
a web server, ASP.NET in C#
and the main program in C#
Example :
tablet calls a web method of the web server -> setA(42)
web server change its static value of a
to 42
main program calls a web method of the web server -> getA()
and so it can save the 42 in his own a
attribute.
So it does the job but it s quiet heavy. I am just exchanging integers or strings. I've heard of socket programming but it appears to be less easy to use especially with firewalls, corporate networks... any ideas :) ?
Upvotes: 0
Views: 1166
Reputation: 101150
I would not go for sockets. As you say, firewalls and routes can be a problem. HTTP is usually open. It's also easier to scale services that use HTTP since everything needed already exists (such as load balancers). You could even direct different versions of your protocol to different servers by using a HTTP proxy.
For that simple requests, simply put everything in the URI:
http://yourservice.com/v1/productname/seta/?value=42
Use JSON for a bit more complex requests:
http://yourservice.com/v1/seta
{
"a": 42,
"b": "Something"
}
Upvotes: 1
Reputation: 7630
Obviously you get a lot of overhead with a web service but much less coding.. Setting up you own socket connection is not really a big deal as both Java(android) and .Net have nice simple support for this.
http://developer.android.com/reference/java/net/Socket.html
http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.aspx
Upvotes: 2