Code: Select all
     try{
               SocketConnection con=
                    (SocketConnection) Connector.open("socket://messenger.hotmail.com:1863");
                
                //Output and input streams opened....
                OutputStream output =con.openOutputStream();
                output.flush();
                output.write("VER 0 MSNP8 CVR0".getBytes());
                output.flush();
                InputStream in =con.openInputStream();
                int inputChar=in.read();
                while ( inputChar!=-1) {
                        sbf.append((char)inputChar);
                        inputChar=in.read();
                }
}
            catch(ConnectionNotFoundException error)
               {
                    Alert alert = new Alert(
                    "Error", "Cannot access socket.", null, null);
                        alert.setTimeout(Alert.FOREVER);
                    alert.setType(AlertType.ERROR);
                    display.setCurrent(alert);
                }
            catch(Exception ex){}
Code: Select all
TcpClient client = new TcpClient();
            try 
	            {
                    client.Connect("messenger.hotmail.com", 1863);
                    if (client.Connected)
                    {
                        textBox1.AppendText("Client is connected\n");
                        NetworkStream networkStream = client.GetStream();
                        StreamWriter streamWriter = new StreamWriter(networkStream);
                        StreamReader streamReader = new StreamReader(networkStream);
                        streamWriter.WriteLine("VER 0 MSNP8 MSNP5 CVR0");
                        streamWriter.Flush();
                        textBox1.AppendText(streamReader.ReadLine()+"\n");
                        streamWriter.WriteLine("CVR 1 0x0409 win 5.1 i386 MSNMSGR 2.1.6000 MSMSGS herat**@hotmail.com");
                        streamWriter.Flush();
                        textBox1.AppendText(streamReader.ReadLine() + "\n");
                        streamWriter.WriteLine("USR 2 TWN I herat**@hotmail.com");
                        streamWriter.Flush();
                        textBox1.AppendText(streamReader.ReadLine() + "\n");
                    }
                    else
                    {
                        textBox1.AppendText("Client is not connected\n");
                    }
	            }
	            catch (Exception)
	            {
		
		            throw;
	            }



