Question

In the Java ME platform that I am using I have only SocketConnection class to connect to a distant server. For example I can create a connection to a server socket on the given ip using Connector.open("socket://"+ip+":"+port).

What I want is to implement an HttpConnection that will use http protocol, a url and port 80 as parameters. I imagine it will be something like Connector.open("http://www.google.com:80) to be able to send GET, POST, DELETE, PUT requests to the server afterwards.

Is there a way to get the ip via url address and then connect to this ip using http protocol? Or if it isn't supported by my platform, then I have to stick to using sockets? I know my question can seem a little abstract, so ask if you need any clarifications.

Was it helpful?

Solution

You have to stick to using sockets. If the Java ME platform that you are using have only SocketConnection, a call to Connector.open("http://www.google.com:80") will throw an exception.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top