0

I have just started a development using wt(with c++ binding). And i have could done till now, is reading a very few documentation and a little no of sample programs(written in c++ and wt).

After that I installed wt on my machine amd tried to run one one of those demo programs.

hello.cc

#include <Wt/WApplication>
#include <Wt/WBreak>
#include <Wt/WContainerWidget>
#include <Wt/WLineEdit>
#include <Wt/WPushButton>
#include <Wt/WText>

class HelloApplication : public Wt::WApplication
{
  public:
  HelloApplication(const Wt::WEnvironment& env);

  private:
  Wt::WLineEdit *nameEdit_;
  Wt::WText *greeting_;

  void greet();
 };

 HelloApplication::HelloApplication(const Wt::WEnvironment& env)
   : Wt::WApplication(env)
{
  setTitle("Hello world");

  root()->addWidget(new Wt::WText("Your name, please ? "));
  nameEdit_ = new Wt::WLineEdit(root());
  Wt::WPushButton *button = new Wt::WPushButton("Greet me.", root());
  root()->addWidget(new Wt::WBreak());
  greeting_ = new Wt::WText(root());
  button->clicked().connect(this, &HelloApplication::greet);
}

void HelloApplication::greet()
{
  greeting_->setText("Hello there, " + nameEdit_->text());
}

Wt::WApplication *createApplication(const Wt::WEnvironment& env)
{
  return new HelloApplication(env);
}

int main(int argc, char **argv)
{
  return Wt::WRun(argc, argv, &createApplication);
}

I complied this code

g++ -o hello hello.cc -lwthttp -lwt

It was compiled successfully.Then I could run this server application successfully to run it on localhost

[manmatha@manmatha Lab]$ su
Password: 
[root@manmatha Lab]# ./hello --docroot  . --http-address 127.0.0.1 --http-port 9090
[2013-Jun-14 13:58:08.585419] 5066-[info] "WServer/wthttp:initializing built-in wthttpd"
[2013-Jun-14 13:58:08.590955] 5066-[info] "wthttp:started server: http://127.0.0.1:9090"

problem is when I type

localhost::9090

on the address bar of the internet browser on local machine., anything does not show up. In this context , my specific question is how to start a wt client?? Thanx in advannce

manmatha.roy
  • 577
  • 1
  • 9
  • 22
  • What do you mean by nothing shows up? Do you have a blank page? Or your browser's 'Cannot connect' error? – rectummelancolique Jun 14 '13 at 09:08
  • i have figured it...that is probably due to some configuration error(i have started and disabled some of the system services, before running that application). rebooting solves the problem – manmatha.roy Jun 14 '13 at 09:19

2 Answers2

0

try 127.0.0.1:9090

You specified 127.0.0.1 on the command line so type it in the browser's address bar. This is a specific of the Wt embedded http server.

user2555515
  • 779
  • 6
  • 20
0

You have to mention the --deploy-path variable in your command line arguments. Try this --http-address 127.0.0.1 --http-port 9090 --deploy-path=/hello --docroot=.

In the browser type http://localhost:9090/hello

Benny
  • 5,218
  • 5
  • 24
  • 28