Hi all,
I am writing an application which uses socket connection.
I am able to establish a connection and can able to send the data.
But I am unable to read the data.
I am using eclipse 3.1 + carbide J1.5, S60 3rd edition FP1.
I don't understand why I am not able to read the data.
Here is my sample code.
SocketConnection sc = (SocketConnection)Connector.open(url);
InputStream is = sc.openInputStream();
OutputStream os = sc.openOutputStream();
os.write("hai!");
int availableData = is.available();
if(availableData==0)
{
System.out.println("data is not available.");
}
else
{
System.out.println("data is available:"+availableData);
}
while (((c = is.read()) != '\n') && (c != -1))
{
sb.append((char)c);
System.out.print((char)c);
}
I am getting is.avaible as 0 in j2me.
But when I tried the same code in normal java program I am getting some value and able to read the incoming data.
Do I need to do any settings for the S60 emulator???
Or
Am I missing anything??
Please help me.
Thanks,
Manoj.

Reply With Quote


