Hello everyone, beforehand, sorry for my english...
I have to do client - server application. They must interact, using classes URL, URLConnection. I understand, how to send data to server. But I can not realize server work.
The common algorithm of server is:
2. Wait for connection.
3. After receiving connection it must process request.
4. Or back for "2" or exit.
as I understand, client code to send request is:
URL url = new URL ("http://" + host + ":" + port); URLConnection c = url.openConnection(); c.setDoOutput(true); c.connect(); OutputStreamWriter out = new OutputStreamWriter(c.getOutputStream()); out.write(URLEncoder.encode(request,"UTF-8") ); out.flush(); out.close();
please help with server code to catch this connection?