April 18, 2014 · 3 min read
Earlier we have seen the [ways of receiving data](http://way2java.com/servlets/handling-the-client-request-html-form-data-3-styles/) from client. Now let us do with response. The **response** object functionality is to send data to client of what client is interested. For this, response uses [IO Streams](http://way2java.com/io/java-io-streams-overview/). There are **two streams** involved depending on the nature of data **like text** data or **binary data**. For text data, the response uses [PrintWriter](http://way2java.com/io/printwriter-%e2%80%93-formatting-data/) and for binary data it uses [ServletOutputStream](http://way2java.com/servlets/response-getoutputstream-example-servlet/). Two methods exist in **ServletResponse** interface (inherited by HttpServletResponse) to return the objects of **PrintWriter** and **ServletOutputStream** – **getWriter()** and **getOuptputStream()**. That is, there are two styles exist.
June 5, 2011 · 5 min read
Before going into the details of client-to-server communication, it is advised to go through [Networking – Introduction](http://way2java.com/networking/networking-introduction/) and [Communication with TCP/IP Protocol](http://way2java.com/networking/communication-with-tcpip-protocol/) to know the terms and basics of networking and the way Java supports.