T
Teofilo Dutra
Note: parts of this message were removed by the gateway to make it a legal Usenet post.
Hi,
I'm trying to use a ruby script in c++ which uses the method get of a
Net::HTTP object,
when I run it(script) in prompt it works, but when I run it in C++ it
returns an error in the get line.
ruby :
require "net/http"
#
# some code...
#
page = "www.somepage.com"
port = 80
param = "someparam"
conn = Net::HTTP.new(page,port)
resp,data = conn.get(param) # get line
#
# some code...
#
c++ :
ruby_init();
ruby_script("script");
char *args[] =
{
"param",
NULL
};
ruby_set_argv((sizeof(args) / sizeof(args[0])) - 1, args);
ruby_init_loadpath();
rb_load_file("script.rb");
int status = ruby_exec();
ruby_cleanup(status);
ruby_finalize();
Error :
../lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo: non-recoverab
le failure in name resolution. (SocketError) from
d:/ruby/lib/ruby/1.8/net/http.rb:560:in `connect' from
d:/ruby/lib/ruby/1.8/timeout.rb:48:in `timeout' from
d:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout' from
d:/ruby/lib/ruby/1.8/net/http.rb:560:in `connect' from
d:/ruby/lib/ruby/1.8/net/http.rb:553:in `do_start' from
d:/ruby/lib/ruby/1.8/net/http.rb:542:in `start' from
d:/ruby/lib/ruby/1.8/net/http.rb:1029:in `request' from
d:/ruby/lib/ruby/1.8/net/http.rb:769:in `get' from script.rb:53
What's missing ? or What's wrong ? Why does the script work in prompt and
not work in C++ ?
Hi,
I'm trying to use a ruby script in c++ which uses the method get of a
Net::HTTP object,
when I run it(script) in prompt it works, but when I run it in C++ it
returns an error in the get line.
ruby :
require "net/http"
#
# some code...
#
page = "www.somepage.com"
port = 80
param = "someparam"
conn = Net::HTTP.new(page,port)
resp,data = conn.get(param) # get line
#
# some code...
#
c++ :
ruby_init();
ruby_script("script");
char *args[] =
{
"param",
NULL
};
ruby_set_argv((sizeof(args) / sizeof(args[0])) - 1, args);
ruby_init_loadpath();
rb_load_file("script.rb");
int status = ruby_exec();
ruby_cleanup(status);
ruby_finalize();
Error :
../lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo: non-recoverab
le failure in name resolution. (SocketError) from
d:/ruby/lib/ruby/1.8/net/http.rb:560:in `connect' from
d:/ruby/lib/ruby/1.8/timeout.rb:48:in `timeout' from
d:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout' from
d:/ruby/lib/ruby/1.8/net/http.rb:560:in `connect' from
d:/ruby/lib/ruby/1.8/net/http.rb:553:in `do_start' from
d:/ruby/lib/ruby/1.8/net/http.rb:542:in `start' from
d:/ruby/lib/ruby/1.8/net/http.rb:1029:in `request' from
d:/ruby/lib/ruby/1.8/net/http.rb:769:in `get' from script.rb:53
What's missing ? or What's wrong ? Why does the script work in prompt and
not work in C++ ?