4

I would like to write a simple google talk client in C++ using libcurl.Google talk uses XMPP as communication protocol and it listens at talk.google.com:5222. First of all I try to access google talk from commandline using curl. If I try

curl talk.google.com:5222 -d "<stream:stream to='gmail.com' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' version='1.0'>"

I get response 302 "The document has moved" If I try to use telnet client

telnet talk.google.com 5222

I can get a valid XMPP response Also if I try to access chat.facebook.com:

curl chat.facebook.com:5222 -d "<stream:stream to='chat.facebook.com'  xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' version='1.0'>"

I get again a valid XMPP response, the only problem is with talk.google.com.

Could someone point out my mistake?

Netfalo
  • 43
  • 4

1 Answers1

2

The "-d" option sends the data as HTTP POST. XMPP is based on raw sockets. So you have to use a option which creates a plain persistent socket like telnet when available. But I am not that familiar with curl.

Alex
  • 4,066
  • 2
  • 19
  • 21
  • So basically I had luck with chat.facebook.com and google talks response was regular? hmm thnx – Netfalo Nov 28 '12 at 00:26
  • I don't think that you had lunch with Facebook. It probably returns some HTTP message instead of the xmpp stream header. – Alex Nov 28 '12 at 06:45