wood burning stoves 2.0*
The moose likes Java Micro Edition and the fly likes socket communication between mobile browser and proxy server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "socket communication between mobile browser and proxy server" Watch "socket communication between mobile browser and proxy server" New topic
Author

socket communication between mobile browser and proxy server

Santhana Lakshmi.S
Ranch Hand

Joined: Aug 16, 2005
Posts: 82
hi
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)Connector.open("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 = in.read(buffer)) > 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: socket communication between mobile browser and proxy server
 
Similar Threads
Problem with client server programming
trouble retrieving html of all web sites
client server programming in j2me
Proxy Server in Java
socket programin in java