View Single Post
Old 03-28-2008, 03:36 PM   #3 (permalink)
hithayath_sait
Thumbs Must Hurt
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: Airtel
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

public SocketConnection getConnection() {
long startTime = 0;
try {
if(sc == null) {

sc = (SocketConnection) Connector.open "socket://"+Utils.getIPAddress()+":5080;deviceside=true;inte rface=wifi", Connector.READ_WRITE);
sc.setSocketOption(SocketConnection.KEEPALIVE, 1);
sc.setSocketOption(SocketConnection.SNDBUF, ((320 * 240 * 2)+20));

}
} catch (ConnectionClosedException e) {
} catch (IOException ioe) {
} catch (Exception e) {
}
return sc;
}


public void writeSocket(byte[] data) {
try {
os.write(data, 0, data.length);
os.flush();
} catch (IOException ioe) {

} catch (Exception e) {

}
}


public byte[] readSocket(int size) {
byte[] data = new byte[size];
try {

is.read(data, 0, data.length);
} catch (IOException ioe) {

} catch (Exception e) {

}
return data;
}


These are my method which does the main trasfer operation.

I am looking forward your suggestion to have good perfomance at transfer.

Last edited by hithayath_sait : 03-28-2008 at 03:41 PM.
Offline   Reply With Quote