hi,
Using j2me i need to send a jpeg Image to a server using Socket Communication...can anyone send me a sample code for my application.
Thnks in Advance Deva
hi,
Using j2me i need to send a jpeg Image to a server using Socket Communication...can anyone send me a sample code for my application.
Thnks in Advance Deva
Take a look at this article from Sun Developer Network. It has some minimalistic examples and should give you some ideas.
...
SocketConnection client = (SocketConnection) Connector.open("socket://" + hostname + ":" + port);
// set application-specific options on the socket. Call setSocketOption to set other options
client.setSocketOption(DELAY, 0);
client.setSocketOption(KEEPALIVE, 0);
InputStream is = client.openInputStream();
OutputStream os = client.openOutputStream();
// send something to server
os.write("some string".getBytes());
// read server response
int c = 0;
while((c = is.read()) != -1) {
// do something with the response
}
// close streams and connection
is.close();
os.close();
client.close();
...