ni30rocks 0 Newbie Poster

I have tried to connect to gmail using IMAP and specification given on http://mail.google.com/support/bin/a...n&answer=78799.

My code looks like

StreamConnection socket;
byte serverData[]= new byte[50];
byte accountInfo[],emailAddInfo[]=new byte[500];
try
{
socket = (StreamConnection)Connector.open("socket://imap.gmail.com:993");

DataOutputStream oStrm = socket.openDataOutputStream();
oStrm.writeChars("Account Name:username@your_domain.com");//my account name
oStrm.writeChars("Email Address:username@your_domain.com");//my email address

InputStream iStrm = socket.openInputStream();
iStrm.read(serverData);
String str= new String(serverData);
System.out.println(str);
list.append(str, null);
for (int i = 0; i < serverData.length; i++)
{
System.out.println(serverData[i]);
}
iStrm.close();

} catch Exception

........

But response from gmail server is empty... Server data is printing streams of 0's...

help me finding out the issue...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.