Reputation: 1808
I want to write an android app to communicate with the PLC devices which this app is supposed to send command and receive some data from the PLC.
My android device and the PLC device is connected to same local network.
If I know the PLC IP address, how can I connect and communicate with it via network?
I'm looking for right way of doing that, some search keys or java libraries will helps.
I found some P2P connection classes in android SDK, but I don't know if it helps. or I don't know if socket programming works for this problem.
Upvotes: 1
Views: 2907
Reputation: 704
This totally depends on what protocols the remote device supports (which you haven't explained). Assuming that it can respond to http, you could use standard http. See this snippet to get started.
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
If you provide more detail then we can give more detailed help.
Upvotes: 1