Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

socket communication between mobile browser and proxy server  RSS feed

Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to connect to internet in mobile through my proxy server.I wrote codings for that.Using my code i am able to get the request from the mobile browser but the problem is i am unable to connect to the proxy server

The following is my code for sending the request to the proxyserver and getting back the response:

s = (SocketConnection)"socket://"+hostname+":"+port);
/*OutStream to write the request to the proxy server*/
OutputStream out = s.openOutputStream(); PrintStream outw = new PrintStream(out); outw.print(requestHeader +"\r\n"); /*Inputstream to read the response from the proxy server*/ InputStream in = s.openInputStream();
/*writing the response in the browser */
byte[] buffer = new byte[1024];
int len;
while((len = > 0) {
os.write(buffer, 0, len);

is my coding correct?or i need to change anything in my codings?
This coding is working fine in emulator and displaying the correct output in the desktop browser.but in mobile it is not working?

Thanks a lot
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!