使用Net :: XMPP

时间:2016-12-29 19:40:22

标签: perl xmpp openfire

我正在使用Perl(或尝试)使用Net :: XMPP模块连接到我们的内部openfire服务器。我的想法是,我将能够连接并向指定的聊天用户发送IM消息。我的代码的这个非常基本的例子是失败的,我似乎无法弄清楚为什么

#!/usr/bin/perl

use strict;
use Net::XMPP;
use Data::Dumper;

my $con = Net::XMPP::Client->new( debuglevel=>1,);
my $host = '<host name here>';
my $user = '<my username>';
my $pass = '<my password>';

my $status = $con->Connect(
    hostname =>  $host,
    connectiontype => 'tcpip',
    tls => 1
);

my @result = $con->AuthSend(
    hostname =>  $host,
    username =>  $user,
    password =>  $pass,
);

print Dumper \@result;

当我执行about代码时,这是消息

  

XML :: Stream:new:hostname =(xxxxxxx)
  XML :: Stream:SetCallBacks:tag(node)func(CODE(0xe540cc))
  XMPP :: Conn:xmppCallbackInit:开始
  XMPP :: Conn:SetCallBacks:tag(message)func(CODE(0x31bce1c))
  XMPP :: Conn:SetCallBacks:tag(presence)func(CODE(0x2ffe78c))
  XMPP :: Conn:SetCallBacks:tag(iq)func(CODE(0x31af94c))
  XMPP :: Conn:SetPresenceCallBacks:type(unsubscribe)func(CODE(0x31b15cc))
  XMPP :: Conn:SetPresenceCallBacks:type(subscribe)func(CODE(0x31af4cc))
  XMPP :: Conn:SetPresenceCallBacks:type(unsubscribed)func(CODE(0x31af424))
  XMPP :: Conn:SetPresenceCallBacks:type(subscribed)func(CODE(0x31b32dc))
  XMPP :: Conn:SetDirectXPathCallBacks:xpath(/ [@ xmlns =&#34; urn:ietf:params:xml:ns:xmpp-tls&#34;])func(CODE(0x31b366c))
  XMPP :: Conn:SetDirectXPathCallBacks:xpath(/ [@ xmlns =&#34; urn:ietf:params:xml:ns:xmpp-sasl&#34;])func(CODE(0x31b6774))
  XMPP :: Conn:xmppCallbackInit:停止
  XMPP :: Conn:Connect:host(xxxxx:5222)命名空间(jabber:client)
  XMPP :: Conn:连接:超时(10)
  XML :: Stream:Connect:type(tcpip)
  XML :: Stream:Connect:有连接
  XML :: Stream:发送:( http://etherx.jabber.org/streams' xmlns =&#39; jabber:client&#39; to =&#39; xxxxx&#39; from =&#39; xxxxx&#39; xml:lang =&#39; en&#39;&gt;)
  XML :: Stream:读取:buff()
  XML :: Stream:读取:buff(PLAINSCRAM-SHA-1EXTERNALCRAM-MD5DIGEST-MD5zlib)
  XMPP :: Conn:连接:建立连接
  XML :: Stream:SetCallBacks:tag(node)func(CODE(0x31b6e34))
  XML :: Stream:发送:()
  XML :: Stream:读取:buff()
  XML :: Stream:TLSClientProceed:将普通套接字转换为SSL
  XML :: Stream:TLSClientProceed:sock(IO :: Socket :: INET = GLOB(0x31b6e1c))
  XML :: Stream:LoadSSL:加载IO :: Socket :: SSL模块
  XML :: Stream:LoadSSL:成功
  XML :: Stream:TLSClientProceed:ssl_sock(IO :: Socket :: INET = GLOB(0x31b6e1c))
  XML :: Stream:TLSClientProceed:SSL:我们很安全   XML :: Stream:发送:( http://etherx.jabber.org/streams' xmlns =&#39; jabber:client&#39; to =&#39; xxxxx&#39; from =&#39; xxxxx&#39; xml:lang =&#39; en&#39;&gt;)
  XML :: Stream:读取:buff(◦◦)
  XML :: Stream:读取:buff()
  XML :: Stream:读取:ERROR
  在C:/Perl/site/lib/XML/Stream.pm第1829行的哈希元素中使用未初始化的值$ sid。
  XMPP :: Conn:AuthIQAuth:旧学校认证   AuthIQAuth需要在chat.pl第16行进行资源争论。
  XMPP :: Conn:SendAndReceiveWithID:object(Net :: XMPP :: IQ = HASH(0x31b9c3c))
  XMPP :: Conn:SendWithID:id(netjabber-0)
  XMPP :: Conn:SendWithID:in(xxxx)
  XMPP :: Conn:RegisterID:tag(iq)id(netjabber-0)
  XMPP :: Conn:SendWithID:out(xxxx)
  XMPP :: Conn:SendXML:sent(xxxx)
  在连接(。)中使用未初始化的值$ sid或在C:/Perl/site/lib/XML/Stream.pm第2735行使用字符串。
  在C:/Perl/site/lib/XML/Stream.pm第2737行的哈希元素中使用未初始化的值$ sid。
  XML :: Stream:发送:(测试)
  在连接(。)中使用未初始化的值$ sid或在C:/Perl/site/lib/XML/Stream.pm第1668行使用字符串。
  在C:/Perl/site/lib/XML/Stream.pm第1669行的哈希元素中使用未初始化的值$ sid。
  在串联(。)中使用未初始化的值或在C:/Perl/site/lib/XML/Stream.pm第1669行使用字符串。
  在C:/Perl/site/lib/XML/Stream.pm第1671行的哈希元素中使用未初始化的值$ sid。
  在C:/Perl/site/lib/XML/Stream.pm第1673行的哈希元素中使用未初始化的值$ sid。
  在C:/Perl/site/lib/XML/Stream.pm第1673行的数字公式(==)中使用未初始化的值。
  在C:/Perl/site/lib/XML/Stream.pm第1675行的哈希元素中使用未初始化的值$ sid。
  在C:/Perl/site/lib/XML/Stream.pm第1678行的哈希元素中使用未初始化的值$ sid。
  在C:/Perl/site/lib/XML/Stream.pm第2615行的哈希元素中使用未初始化的值$ sid。
  在连接(。)中使用未初始化的值$ sid或在C:/Perl/site/lib/XML/Stream.pm第2735行使用字符串。
  在C:/Perl/site/lib/XML/Stream.pm第2737行的哈希元素中使用未初始化的值$ sid。
  XMPP :: Conn:SendAndReceiveWithID:以id(netjabber-0)发送   XMPP :: Conn:WaitForID:id(netjabber-0)
  XMPP :: Conn:ReceivedID:id(netjabber-0)
  XMPP :: Conn:ReceivedID:nope ...
  XMPP :: Conn:WaitForID:还没有得到它......让我们等待更多的数据包
  XMPP :: Conn:处理:超时(1)
  在串联(。)中使用未初始化的值或在C:/Perl/site/lib/XML/Stream.pm第1440行使用字符串。
  在C:/Perl/site/lib/XML/Stream.pm第1442行的数字公式(==)中使用未初始化的值。
  在C:/Perl/site/lib/XML/Stream.pm第1506行的数字eq(==)中使用%初始状态中的未初始化值。
  在C:/Perl/site/lib/XML/Stream.pm第1507行的减法( - )中使用未初始化的值。
  XML :: Stream:发送:()
  在串联(。)中使用未初始化的值或在C:/Perl/site/lib/XML/Stream.pm第1669行使用字符串。
  在C:/Perl/site/lib/XML/Stream.pm第1673行的数字公式(==)中使用未初始化的值。
  XMPP :: Conn:ReceivedID:id(netjabber-0)
  XMPP :: Conn:ReceivedID:nope ...
  XMPP :: Conn:WaitForID:还没有得到它......让我们等待更多的数据包
  XMPP :: Conn:处理:超时(1)
  XML :: Stream:发送:()
  XML :: Stream:发送:()
  XML :: Stream:发送:()
  $ VAR1 = [];

检查服务器我可以看到连接请求,防火墙也允许连接通过并使用pigin和客户端类型XMPP,我可以通过用户连接。任何帮助将不胜感激

0 个答案:

没有答案