Socket programming and networking examples in Java.
Sometimes an application needs to communicate to a web server to send/receive data through HTTP. For example, connecting to a financial service to get stock price, posting user data to server to save in database, or checking for a new version of an application if available.
This article will guide you to write a generic utility method that can connect to a specified URL with either HTTP’s GET/POST method, and attaching parameters to the request. The method will return server’s response