Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Can only connect to XMPP server as with perl Net::XMPP module

by gauss76 (Beadle)
on Dec 03, 2019 at 08:28 UTC ( #11109581=perlquestion: print w/replies, xml ) Need Help??

gauss76 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to connect to an XMPP server and send a message to another user using the following perl code

(taken from

It works but the mesage is sent from I know this because I have Pidgin running as another user on the same XMPP server and recieve the message from my perl program from Pidgin also shows as offline!

#!/usr/bin/perl use strict; use Net::XMPP; my ($recip, $msg) = @ARGV; if(! $recip || ! $msg) { print 'Syntax: $0 <recipient> <message>\n'; exit; } my $con = new Net::XMPP::Client(); my $status = $con->Connect( hostname => 'xx.xx.xx.xx',port=>5222, connectiontype => 'tcpip',tls => 0); die('ERROR: XMPP connection failed') if ! defined($status); my @result = $con->AuthSend( username => 'Uname', password => 'PWord', resource=>'Test'); die('ERROR: XMPP authentication failed') if $result[0] ne 'ok'; die('ERROR: XMPP message failed') if ($con->MessageSend(to => $recip, +body => $msg) != 0); print 'Success!\n';

From the code I would expect to by connected as Uname. Why is this not the case?

  • Comment on Can only connect to XMPP server as with perl Net::XMPP module
  • Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11109581]
Front-paged by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2020-01-26 20:10 GMT
Find Nodes?
    Voting Booth?