AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

C++ and Wt (Witty) Library
 
 

Greetings fellow chatbottanists,

My chatbot STU (a philosophy bot—STU = “solves the universe”) was originally begun in Javascript. But that language is too limited for a large project, so I recently switched over to C++. Problem is, how does one interface C++ with the internet in order to put one’s chatbot up for the world at large to enjoy?

There seem to be a handful of possible solutions available, one of which is the opensource library Wt (pronounced Witty). I work on a linux box myself, which has a fantastic version of C++ put out by the GNU folks. Anyway, I was wondering if anyone has worked with Wt at all or has dealt with the issue of putting up a C++ program on the internet in some other way?

Thanks for any input. Incidentally, since I’m only just getting into the C++ version of STU, I will also be taking a peak at some of the web-specific languages, particularly Java. Any comments on these would also be of interest.

Happy chatting,

Eulalio

 

 
  [ # 1 ]

If you have experience in C, C# might be better suited for you. There is a cross platform version called Mono.
http://www.mono-project.com/Main_Page

 

 
  [ # 2 ]

There is code for C++ as server in ChatScript.. that that’s what you are looking for.

 

 
  [ # 3 ]
Merlin - Nov 29, 2011:

If you have experience in C, C# might be better suited for you. There is a cross platform version called Mono.
http://www.mono-project.com/Main_Page

Thanks, Merlin. I will check it out. However, I’m not sure if this gets at the issue. It’s not so much a cross-platform issue as one of writing a chatbot in C++ and then making the user interface of that chatbot available inside a webpage.

 

 
  [ # 4 ]

You can do that with C#. Details depend on what type of site you want and how it will be hosted.

C# Web Service:
http://www.codeproject.com/KB/webservices/myservice.aspx

Web Application:
http://msdn.microsoft.com/en-us/library/aa302124(v=vs.71).aspx

WPF with C# code behind:
http://msdn.microsoft.com/en-us/library/ms752059.aspx

 

 
  [ # 5 ]
Merlin - Nov 30, 2011:

You can do that with C#. Details depend on what type of site you want and how it will be hosted.

C# Web Service:
http://www.codeproject.com/KB/webservices/myservice.aspx

Web Application:
http://msdn.microsoft.com/en-us/library/aa302124(v=vs.71).aspx

WPF with C# code behind:
http://msdn.microsoft.com/en-us/library/ms752059.aspx

I guess that’s the point, Merlin. I am assuming a typical external webhost. I simply want to be able to put up a simple interface so that people can interact with my chatbot. Regardless of what the code is written in, it seems that the webhost would have to have a server that could run that underlying code. So the question is, whether this would ever be possible for a C++ program. And, if not, would support of this type be common for C# as it appears to be for Java or PHP, for example?
(Is this even the right question?)

 

 
  [ # 6 ]

There are a variety of open source light weight (i.e. easy to use) C and C++ libraries available for turning your application into a web host. There are probably so many different ones because it is so easy to write such a thing. It certainly doesn’t have to be a behemoth like Apache (which by the way is very easy to write modules for, in spite of the lack of documentation—check out http://asmith.id.au/mod_libpq.html for an example).

Bruce mentioned that ChatScript has its own built in web server (written in C++) and I’ve also written a fairly powerful web server in C for use with my own code.

Just go to SourceForge.net or GitHub.com and search for HTTPD and you’ll find plenty to choose from.

 

 
  [ # 7 ]
Andrew Smith - Dec 1, 2011:

There are a variety of open source light weight (i.e. easy to use) C and C++ libraries available for turning your application into a web host. There are probably so many different ones because it is so easy to write such a thing. It certainly doesn’t have to be a behemoth like Apache (which by the way is very easy to write modules for, in spite of the lack of documentation—check out http://asmith.id.au/mod_libpq.html for an example).

Bruce mentioned that ChatScript has its own built in web server (written in C++) and I’ve also written a fairly powerful web server in C for use with my own code.

Just go to SourceForge.net or GitHub.com and search for HTTPD and you’ll find plenty to choose from.

Maybe I’m not making myself clear here. (I’m a fairly experienced programmer, but from a past generation, so not really fully up-to-speed with internet protocols.)

So, let me try again. If I write a chatbot in C++ and use something like Wt library to turn it into an interactive web application, can a third party like Hostmonster or whoever take the result and put it up as a webpage for me? (I guess the confusion pertains to the term “web server” which suggests to me something that would have to be hosted from my computer ... What am I missing here?)

 

 
  [ # 8 ]

Probably not unless you get a dedicated host (e.g. from ServerBeach or Server4You) or some other kind of environment that gives you a whole computer (whether real or virtual) to play with. Otherwise you’re probably limited to scripting environments. You get what you pay for.

I’ve always found it cheaper and easier to self-host. Even though I can only afford ADSL2 here, I’ve been successfully hosting tracktype.org for many years, and it has handled up to a million hits a day. It can do this because it is lots of small text files. If you want to do anything media intensive you would have to rent a box in a data centre somewhere.

 

 
  [ # 9 ]
Andrew Smith - Dec 1, 2011:

Probably not unless you get a dedicated host (e.g. from ServerBeach or Server4You) or some other kind of environment that gives you a whole computer (whether real or virtual) to play with. Otherwise you’re probably limited to scripting environments. You get what you pay for.

I’ve always found it cheaper and easier to self-host. Even though I can only afford ADSL2 here, I’ve been successfully hosting tracktype.org for many years, and it has handled up to a million hits a day. It can do this because it is lots of small text files. If you want to do anything media intensive you would have to rent a box in a data centre somewhere.

Thanks for clarifying that, Andrew. Can you give me a few more details on exactly how you go about hosting tracktype.org? Equipment, software, costs, maintenance, etc. Do you think that most of the more complex online chatbots, especially those with 3D avatars, are mostly self-hosted pages?

 

 
  [ # 10 ]
Eulalio Paul Cane - Dec 1, 2011:

Thanks for clarifying that, Andrew. Can you give me a few more details on exactly how you go about hosting tracktype.org? Equipment, software, costs, maintenance, etc. Do you think that most of the more complex online chatbots, especially those with 3D avatars, are mostly self-hosted pages?

The main thing that you need to be able to self-host is an internet connection with a fixed IP address. It is possible to self-host if you only have a dynamic IP address using services like dyndns.com (I don’t know the details, you would have to read their website) but services without fixed IP addresses often have the ports that you need blocked anyway. There are workarounds for that too, but probably not worth the effort.

Generally speaking, you need a minimum of business grade ADSL with a fixed IP address. The service that I use costs $70 per month and allows 100 gigabytes of downloads and 400 gigabytes of uploads per month. This is more than adequate for any amount of text and a few images, but would not be satisfactory for serving video under anything but the lightest of loads (it would be too slow).

As for the equipment that you need, that depends on the applications that you are trying to run. In most countries, if you store any kind of personal information on a server there is a legal requirement that it has to be behind two firewalls (i.e. the one to the internet, and a second one on your LAN). This means a minimum of two servers, although the one facing the internet in that case doesn’t have to be very powerful. Mine is a 32-bit single core processor with 3 gigabytes of RAM and a couple of fast hard drives. The main system is a 64-bit quad core processor with 8 gigabytes of RAM and a lot more fast hard drives. However I don’t bother with RAID on any of these systems.

Unless lives and livelihoods are at risk, you don’t need to spend a lot of money on fancy hardware for your servers and power supplies. If you buy good quality consumer grade components (i.e. Asus, Western Digital, Dell) you don’t need to worry about reliability. I keep plenty of spare components in the cupboard so that if something fails it doesn’t take long to get things up and running again, but that doesn’t seem to happen very often either.

At one time I was running my server off an uninterruptible power supply but I don’t even bother doing that any more, as power outages are so rare. If you do need to put together something like that, it is not difficult. You need a pure sine inverter with at least double the rating of your server (i.e. my server draws 200 watts, so I use a 600 watt pure sine inverter). A standard car battery is enough to keep it running for more than two hours, longer than any power outage I’ve ever experienced here. The battery and inverter are connected to the mains via a 40 amp 13.9 volt fixed bench supply which normally supplies the inverter and trickle charges the battery. As long as you use thick enough wires (i.e. very thick and short, 4 or 8 AWG) it is simple to connect it all up.

When I started out doing all this, it would have cost around a thousand dollars a month to rent an adequate hosting service, so doing it all myself represented a huge saving. However the cost of dedicated hosting, and the power of the servers that are available, has fallen so much in the intervening time that going with a service like server4you.com is pretty much a no brainer now, unless you already have everything that you need in place and wouldn’t have to spend any more to get going.

 

 

 
  [ # 11 ]

So, I pay around 80$ for a premium, shared silver hosting service a year (you can get lower, but then the speed goes down). I have a windows plan, so what I put up there is mostly C#. But there are also linux hosting plans offered together with windows.
Depending on your hosting provider, you have more or less freedoms. I was originally with godaddy, which is durt cheap, but they limit the things you can do with the server (in windows (asp.net), this can be a problem sometimes). Now, I am with softsys. They allow you to run your software with full control.
Downside to this: you need to maintain your soft from a distance, you can’t physically touch it, you can’t put up your own ‘server’ software like an another database system (well, you often can, for some extra $$).
upside: a heck of a lot cheaper, backups are done for you daily, when the server goes down, you don’t even need to contact anybody, it just gets fixed, automatic hardware upgrades,....

 

 
  [ # 12 ]
Jan Bogaerts - Dec 2, 2011:

So, I pay around 80$ for a premium, shared silver hosting service a year (you can get lower, but then the speed goes down). I have a windows plan, so what I put up there is mostly C#. But there are also linux hosting plans offered together with windows.

Details please.

I’d be very surprised if what you’re using would be suitable for anything but the most trivial applications, but I’m certainly keen to keep abreast of the latest developments.

I’d also be curious to know what kind of service chatbots.org is using because frankly, I find the performance barely tolerable most of the time.

 

 

 
  [ # 13 ]

I’m able to run my chatbot (with character/avatar and lip-sync) on there.
Limitations are:
-2 dbs systems (I think mysql, the one used by wordpress)
-2 ms sql dbs
-unlimited msaccess db files (not really useful).
-max 2 root webaddress (type: http://www.mywebsite.com), I think a limit of 100 websites or so
-I think a max of 100 email addresses
-I asked and you can’t run a chatbot hosting service on a shared plan.

-If any of these limits is a problem: either pay more, upgrade to virtual dedicated server or get a real dedicated server (which is a bit more expensive: 75$ a month, for that kind of money, you’re probably better off hosting yourself).

here’s more info: http://www.softsyshosting.com/

What you say about limitations is very true: like I said, I was originally with godaddy, but I left them cause there were to many restrictions (read: I couldn’t get my chatbot system to run on their shared service plans). But if you know what to look for (which features should be present like: “ASP.NET Full Trust Mode(On request)” ), you can usually find some pretty descent hosting companies for small websites like mine.

 

 
  [ # 14 ]

The hosting plan that I use is similar in features to what Jan has outlined, including the restriction against custom chatbot servers, but since Morti uses a PHP based AIML interpreter, that doesn’t pose a problem for me. the cost is also comparable. I also used to have a publicly available, self-hosted website, but my ISP has since blocked all incoming ports to my local network, so while my local server is still active, it’s no longer publicly available. Of course, this also means that I can’t host any other types of servers, such as Quake 3 or Starcraft game servers, or TeamSpeak or Ventrillo servers, but these are minor issues. smile

 

 
  [ # 15 ]

I guess the point that I should have been making above is that the service on which I am doing all my hosting is barely more expensive than the service that we would be using if it were just a normal household. The extra $20 per month that we pay gets us a large block of fixed IP addresses, superb technical support, and no restrictions on bandwidth, services or port access.

Anyone who would like to be able to run whatever software they want on the internet should consider upgrading their domestic grade broadband to business grade broadband to get the same benefits. You don’t need anything fancy as a server and Linux makes it easy and secure to do. The computer that I use as the main server now is eight years old.

 

 1 2 > 
1 of 2
 
  login or register to react