# New user problem about xmpp4r

**URL:** <https://www.ruby-forum.com/t/new-user-problem-about-xmpp4r/133454>\
**Category:** Ruby\
**Created:** [March 31, 2008, 7:07pm UTC](https://www.ruby-forum.com/t/new-user-problem-about-xmpp4r/133454 "2008-03-31T19:07:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [March 31, 2008, 7:07pm UTC](https://www.ruby-forum.com/t/new-user-problem-about-xmpp4r/133454/1 "2008-03-31T19:07:15Z")

</div>

Hi. I’m mew user of xmpp4r. After I install xmpp4r and xmpp4r-sample  
completely.

and I go to C:\Program  
Files\Ruby\lib\ruby\gems\1.8\gems\xmpp4r-0.3.2\data\doc\xmpp4r\examples\basic

that I found many example program and I choose change\_password.rb to  
work in command line.

then I type

change\_password removed\_email\_address@domain.invalid _ **my old password** _ _**my new  
password**_

and It’s not responding message for long time and show me error like  
this

Connecting… Error: Bad file descriptor - connect(2)  
…/…/…/…/…/lib/xmpp4r/connection.rb:60:in `initialize’: Bad file  
descriptor

- connect(2) (Errno::EBADF)  
from …/…/…/…/…/lib/xmpp4r/connection.rb:60:in `new' from ../../../../../lib/xmpp4r/connection.rb:60:in`connect’  
from …/…/…/…/…/lib/xmpp4r/client.rb:71:in `connect' from C:/Program Files/Ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/data/doc/ xmpp4r/examples/basic/change_password.rb:37 from C:/Program Files/Ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/data/doc/ xmpp4r/examples/basic/change_password.rb:16:in`with\_status’  
from C:/Program  
Files/Ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/data/doc/  
xmpp4r/examples/basic/change\_password.rb:37

C:\Program  
Files\Ruby\lib\ruby\gems\1.8\gems\xmpp4r-0.3.2\data\doc\xmpp4r\exampl  
es\basic\>

how can I solve this problem???

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 5, 2008, 7:43am UTC](https://www.ruby-forum.com/t/new-user-problem-about-xmpp4r/133454/2 "2008-05-05T07:43:53Z")

</div>

I am also facing the same problem.  
I think there is an issue with xmpp4r.  
Can anyone give any solution???

Thanks and Regards  
Lokesh Agrawal

Pat K. wrote:

> Hi. I’m mew user of xmpp4r. After I install xmpp4r and xmpp4r-sample  
> completely.
> 
> and I go to C:\Program  
> Files\Ruby\lib\ruby\gems\1.8\gems\xmpp4r-0.3.2\data\doc\xmpp4r\examples\basic
> 
> that I found many example program and I choose change\_password.rb to  
> work in command line.
> 
> then I type
> 
> change\_password removed\_email\_address@domain.invalid _ **my old password** _ _**my new  
> password**_
> 
> and It’s not responding message for long time and show me error like  
> this
> 
> Connecting… Error: Bad file descriptor - connect(2)  
> …/…/…/…/…/lib/xmpp4r/connection.rb:60:in `initialize’: Bad file  
> descriptor
> 
> - connect(2) (Errno::EBADF)  
> from …/…/…/…/…/lib/xmpp4r/connection.rb:60:in `new' from ../../../../../lib/xmpp4r/connection.rb:60:in`connect’  
> from …/…/…/…/…/lib/xmpp4r/client.rb:71:in `connect' from C:/Program Files/Ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/data/doc/ xmpp4r/examples/basic/change_password.rb:37 from C:/Program Files/Ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/data/doc/ xmpp4r/examples/basic/change_password.rb:16:in`with\_status’  
> from C:/Program  
> Files/Ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/data/doc/  
> xmpp4r/examples/basic/change\_password.rb:37
> 
> C:\Program  
> Files\Ruby\lib\ruby\gems\1.8\gems\xmpp4r-0.3.2\data\doc\xmpp4r\exampl  
> es\basic\>
> 
> how can I solve this problem???

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 5, 2008, 8:48am UTC](https://www.ruby-forum.com/t/new-user-problem-about-xmpp4r/133454/3 "2008-05-05T08:48:46Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Pat K. wrote:

| then I type  
|  
| change\_password removed\_email\_address@domain.invalid _ **my old password** _ _**my new  
| password**_  
|  
| and It’s not responding message for long time and show me error like  
| this  
|  
|  
|  
| Connecting… Error: Bad file descriptor - connect(2)  
| …/…/…/…/…/lib/xmpp4r/connection.rb:60:in `initialize': Bad file | descriptor | - connect(2) (Errno::EBADF) | from ../../../../../lib/xmpp4r/connection.rb:60:in `new’  
| from …/…/…/…/…/lib/xmpp4r/connection.rb:60:in `connect' | from ../../../../../lib/xmpp4r/client.rb:71:in `connect’  
| from C:/Program  
| Files/Ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/data/doc/  
| xmpp4r/examples/basic/change\_password.rb:37  
| from C:/Program  
| Files/Ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/data/doc/  
| xmpp4r/examples/basic/change\_password.rb:16:in `with\_status’  
| from C:/Program  
| Files/Ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/data/doc/  
| xmpp4r/examples/basic/change\_password.rb:37  
|  
| C:\Program  
| Files\Ruby\lib\ruby\gems\1.8\gems\xmpp4r-0.3.2\data\doc\xmpp4r\exampl  
| es\basic\>  
|  
|  
| how can I solve this problem???

Simple: While GTalk is a Jabber-based service, it is not a complete  
Jabber _server_. Try the command with a pure Jabber server (one that  
doesn’t use SSL, too, though you might not want to change your password  
over an insecure channel), like [jabber.org](http://jabber.org).

* * *

Phillip G.  
Twitter: [twitter.com/cynicalryan](http://twitter.com/cynicalryan)  
Blog: [http://justarubyist.blogspot.com](http://justarubyist.blogspot.com)

That was not manual override.  
~ – Data, “Contagion”, stardate 42609.1  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iEYEARECAAYFAkgerZkACgkQbtAgaoJTgL8ZjgCdEzDehkIGcu88lBNzXHZqXJx8  
3toAoJ2VHcnHyR6q1NBsqMsxDEv2UD/u  
=4N63  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 5, 2008, 9:05am UTC](https://www.ruby-forum.com/t/new-user-problem-about-xmpp4r/133454/4 "2008-05-05T09:05:13Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Lokesh Agrawal wrote:  
A: It makes it unnecessarily difficult to follow the conversation.  
Q: Why is top-posting bad?

| Hi Phillip,  
|  
| Thanks for reply.  
|  
| I am running a simple script to send message to a gtalk user.  
| But I am getting same error.  
| I think using xmmp4r-simple we should be able to send message to a gtalk  
| user.

Take a look at GTalk’s help page, and see how clients are supposed to  
connect to GTalk.

Otherwise, it might help to ask on the xmpp4r/xmpp4r-simple mailing  
list.

| Or is there anyother way in ruby by which i can send message to a gtalk  
| user

Yes, via Socket. Dunno if you want to do that, though, since you’ll have  
to do everything yourself.

* * *

Phillip G.  
Twitter: [twitter.com/cynicalryan](http://twitter.com/cynicalryan)  
Blog: [http://justarubyist.blogspot.com](http://justarubyist.blogspot.com)

Worship God. Love People. Use Things. Don’t Mix Them Up!  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iEYEARECAAYFAkgesYAACgkQbtAgaoJTgL+7hwCdGAGe4swtQHgZo+10ZtH4F5PX  
CSkAn1IW+4JxB6xV6vVMda5jj1F+HXs1  
=2anX  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 5, 2008, 8:56am UTC](https://www.ruby-forum.com/t/new-user-problem-about-xmpp4r/133454/5 "2008-05-05T08:56:40Z")

</div>

Hi Phillip,

Thanks for reply.

I am running a simple script to send message to a gtalk user.

require ‘rubygems’  
require ‘xmpp4r-simple’

username = ‘myusername’  
password = ‘mypassword’  
$to\_username = ‘destnationusername’

puts “connecting to jabber server…”  
jabber = Jabber::Simple.new(username+‘@gmail.com’, password)  
puts “Connected.”  
jabber.deliver($to\_username+"@gmail.com", “Hello…!”)

Thread.new{  
while true  
jabber.deliver($to\_username+"@gmail.com", $stdin.gets)  
puts “-”\*80  
end  
}

while (true) do  
jabber.received\_messages do |msg|  
puts “=”\*80  
$to\_username = msg.from.node  
puts msg.from.node + “:” + msg.body  
end  
sleep(1)  
end

But I am getting same error.

connecting to jabber server…  
c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.1/lib/xmpp4r/connection.rb:53:in  
`init ialize': Bad file descriptor - connect(2) (Errno::EBADF) from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.1/lib/xmpp4r/connection.r b:53:in `new’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.1/lib/xmpp4r/connection.r  
b:53:in `connect' from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.1/lib/xmpp4r/client.rb:73 :in `connect’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.1/lib/xmpp4r/client.rb:60  
:in `connect' from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.1/lib/xmpp4r/client.rb:58 :in `each’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.1/lib/xmpp4r/client.rb:58  
:in `connect' from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-simple-0.8.4/lib/xmpp4r-simpl e.rb:371:in `connect!’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-simple-0.8.4/lib/xmpp4r-simpl  
e.rb:309:in `client' from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-simple-0.8.4/lib/xmpp4r-simpl e.rb:318:in `send!’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-simple-0.8.4/lib/xmpp4r-simpl  
e.rb:134:in `status' from c:/ruby/lib/ruby/gems/1.8/gems/xmpp4r-simple-0.8.4/lib/xmpp4r-simpl e.rb:85:in `initialize’  
from gtalk.rb:9:in `new’  
from gtalk.rb:9

I think using xmmp4r-simple we should be able to send message to a gtalk  
user.

Or is there anyother way in ruby by which i can send message to a gtalk  
user

Thanks and Regards  
Lokesh Agrawal

Phillip G. wrote:

> -----BEGIN PGP SIGNED MESSAGE-----  
> Hash: SHA1
> 
> Pat K. wrote:
> 
> | then I type  
> |  
> | change\_password removed\_email\_address@domain.invalid _ **my old password** _ _**my new  
> | password**_  
> |  
> | and It’s not responding message for long time and show me error like  
> | this  
> |  
> |  
> |  
> | Connecting… Error: Bad file descriptor - connect(2)  
> | …/…/…/…/…/lib/xmpp4r/connection.rb:60:in `initialize': Bad file | descriptor | - connect(2) (Errno::EBADF) | from ../../../../../lib/xmpp4r/connection.rb:60:in `new’  
> | from …/…/…/…/…/lib/xmpp4r/connection.rb:60:in `connect' | from ../../../../../lib/xmpp4r/client.rb:71:in `connect’  
> | from C:/Program  
> | Files/Ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/data/doc/  
> | xmpp4r/examples/basic/change\_password.rb:37  
> | from C:/Program  
> | Files/Ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/data/doc/  
> | xmpp4r/examples/basic/change\_password.rb:16:in `with\_status’  
> | from C:/Program  
> | Files/Ruby/lib/ruby/gems/1.8/gems/xmpp4r-0.3.2/data/doc/  
> | xmpp4r/examples/basic/change\_password.rb:37  
> |  
> | C:\Program  
> | Files\Ruby\lib\ruby\gems\1.8\gems\xmpp4r-0.3.2\data\doc\xmpp4r\exampl  
> | es\basic\>  
> |  
> |  
> | how can I solve this problem???
> 
> Simple: While GTalk is a Jabber-based service, it is not a complete  
> Jabber _server_. Try the command with a pure Jabber server (one that  
> doesn’t use SSL, too, though you might not want to change your password  
> over an insecure channel), like [jabber.org](http://jabber.org).
> 
> * * *
> 
> Phillip G.  
> Twitter: [twitter.com/cynicalryan](http://twitter.com/cynicalryan)  
> Blog: [http://justarubyist.blogspot.com](http://justarubyist.blogspot.com)
> 
> That was not manual override.  
> ~ – Data, “Contagion”, stardate 42609.1  
> -----BEGIN PGP SIGNATURE-----  
> Version: GnuPG v1.4.8 (MingW32)  
> Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)
> 
> iEYEARECAAYFAkgerZkACgkQbtAgaoJTgL8ZjgCdEzDehkIGcu88lBNzXHZqXJx8  
> 3toAoJ2VHcnHyR6q1NBsqMsxDEv2UD/u  
> =4N63  
> -----END PGP SIGNATURE-----
