File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Help request on proxy for socket I/O Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Help request on proxy for socket I/O" Watch "Help request on proxy for socket I/O" New topic
Author

Help request on proxy for socket I/O

Steve Wang
Greenhorn

Joined: Jun 27, 2003
Posts: 18
I am writing a proxy server using pure Java socket (no URL-related classes is allowed). Basically the proxy reads request from browser and forward to appropriate server. Then it reads response back from server and writes to browser. This is the first step. I am having troubles in getting this step to work out .

Since read/write from/to socket is byte-oriented I/O operations. So I used InputStream-derived classes (like BufferedInputStream ...) to read from browser
readByteFromBrowser = new BufferedInputStream (clientSocket.getInputStream());
For writing operation I used OuputStream-derived class (like BufferedOutputStream...) to read response from server.
My question is:
(1) should I use InputStream/OutputStream-derived classes to deal with I/O operations?
(2) My proxy works sometims ok for pure-text, and sucks on mixed content-type.
I posted the code that I am running and hope someone could give me some hint. I would appreciate it.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help request on proxy for socket I/O
 
Similar Threads
File Transfer via Sockets
How to append response to the incoming request from Socket and write to another Socket.....
NullPointerException when writing to a socket.
FTP(File transfer)
Sending a file over socket