aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes A simple proxy - problem returning response data to the client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "A simple proxy - problem returning response data to the client" Watch "A simple proxy - problem returning response data to the client" New topic
Author

A simple proxy - problem returning response data to the client

uohz xela
Greenhorn

Joined: Oct 06, 2013
Posts: 1
My programming assignment requires me to create a proxy in between client and server.
My client make a request to server through the proxy, then the proxy forwards it and returns back the response from the server to the client.

Here's the steps I took:

1) get request from client and store the request data into a byte array

2) read from the byte array using buffered reader

3) get the host name from the Host: header field and create a serverSocket with it

4) forward the request data to the serverSocket outputstream

5) retrieve the response data from the serverSocket inputstream into another byte array

6) write contents from the byte array into clientSocket output stream

However, after step 6, the browser is unable to display the response data. Any help?

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: A simple proxy - problem returning response data to the client