Hello everybody,

I try to connect to a remote server using tcp ip
and a non stardard port 1xxx.

And I'm not far away from getting mad about this :-(

Can anybody tell me what's wrong with my code?

It works great in the S40 emulator but hangs on the 6230i.
I have GPRS connectivity enabled on the phone ...

AFAIK I don't need a certificate for ip connection on ports like 1273 - or am I wrong here?


Thank you VERY much!
Peter


SocketConnection conn= null;

InputStream is = null;
OutputStream os = null;
StringBuffer sb = new StringBuffer();

int rc = 0;
try
{
conn = (SocketConnection) Connector.open("socket://"+url);
is = conn.openInputStream();
os = conn.openOutputStream();

String wrappedLogin = "someData";
String wrappedData = "even more data";

os.write(wrappedLogin.getBytes());
os.write(wrappedData.getBytes());

int index= 0;
int ch;
while ((ch = is.read()) != -1)
{
index++;
if ((ch != 0x0a) && (ch != 0x00) && (index>7))
{
sb.append((char) ch);
}
}
}
catch (IOException ex)
{
return ex.getMessage();
}
finally
{
if (is!=null)
{
try
{
is.close();
}
catch (IOException ex)
{
}
}

if (os!=null)
{
try
{
os.close();
}
catch (IOException ex)
{
}
}

if (conn!=null)
{
try
{
conn.close();
}
catch (IOException ex)
{
}
}
}