• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Help request on proxy for socket I/O

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Good night. Drive safely. Here's a tiny ad for the road:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic