segunda-feira, 20 de julho de 2015

Extensible Messaging and Presence Protocol (XMPP)

http://xmpp.org/about-xmpp/



                    System.Net.Sockets.Socket Client=new System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    bool Diponibilidade =false;
                    try
                    {
                           String IPSelected  = IP ;
                           String Port = Porta;
                           int  alPort = System.Convert.ToInt16 (Port,10);
                           System.Net.IPAddress       remoteIPAddress     = System.Net.IPAddress.Parse(IPSelected);
                           System.Net.IPEndPoint      remoteEndPoint = new System.Net.IPEndPoint(remoteIPAddress, alPort);
                           Client.Connect(remoteEndPoint);
                           Diponibilidade = true;
                           Client.Close ();
                    }
                    catch (SocketException)
                    {
                           Diponibilidade  = false;
                           Client.Close ();
                    }
                    catch (Exception oEx)
                    {
                           throw oEx;
                    }
                    return Diponibilidade ;
             }
       


String szData  ="  xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'  to='jabber2.lapuinka.org.br'  version='1.0'>";
                           byte[] byData = System.Text.Encoding.ASCII.GetBytes(szData);
                           int i = m_socClient.Send(byData);
                           byte[] ret = new byte [256];
                           i = m_socClient.Receive(ret);
                           MessageBox.Show (Encoding.UTF8.GetString(ret));

Postar um comentário