Chat server port, TCP or UDP?

Chat server port, TCP or UDP?

by Genner Cerna -
Number of replies: 34

I wanted to configure the chat using port 9111. Is the port TCP or UDP, source or destination...

Thanks in advance...

Average of ratings: -
In reply to Genner Cerna

Re: Chat server port, TCP or UDP?

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
TCP, in and out.
In reply to Martin Dougiamas

Re: Chat server port, TCP or UDP?

by Genner Cerna -

I added TCP, in and out but when I loaded the chat page, it saids page cannot be loaded. By the way I'm using 1.4 stable.

In reply to Genner Cerna

Re: Chat server port, TCP or UDP?

by Tim Allen -

I just had a look at this and had the same problem after configuring via the chat module settings page, but after reading README.txt in the moodle/mod/chat directory, found the following extra step that is needed:

cd moodle/mod/chat
php chatd.php --start &

After I did this the problem you described above disappeared and the chat seems to be working perfectly now!  big grin

A quick question for Martin or someone else: once started via "php chatd.php --start &", will the chat daemon run continously?  If I need to shut the daemon down, what command should I use?

Tim.

In reply to Tim Allen

Re: Chat server port, TCP or UDP?

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Yes, the chat server does need to be running.  big grin  tongueout

Yes, it runs continously.

To shut it down you need to kill the process in Unix.  I usually do

   ps fax

find the process ID (eg 12345) and then

   kill 12345
In reply to Martin Dougiamas

Re: Chat server port, TCP or UDP?

by Genner Cerna -

What about when the server goes down, is the chat deamon starts automatically when the servers goes online?

In reply to Genner Cerna

Re: Chat server port, TCP or UDP?

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
No, you have to organise that yourself.  The usual way is to create a start script in /etc/rc.d/init.d etc ...
In reply to Martin Dougiamas

Re: Chat server port, TCP or UDP?

by Genner Cerna -
I see, how would be the script look like in unix?
In reply to Genner Cerna

Re: Chat server port, TCP or UDP?

by Genner Cerna -

Chat stops when I restart network service? What will I add in the init.d?

-Thanks in advance Martin...

In reply to Martin Dougiamas

Re: Chat server port, TCP or UDP?

by Tony Hursh -
If anyone wants an AppleScript to start up the chat daemon under OS X, let me know. Nothing too fancy (actually it just executes the proper Unix commands) but it makes it possible to start the chat daemon by clicking on an icon. I wrote it for some of my coworkers who aren't comfortable with the Unix command line.



In reply to Tony Hursh

Re: Chat server port, TCP or UDP?

by Genner Cerna -
Do you have for UNIX?
In reply to Genner Cerna

Re: Chat server port, TCP or UDP?

by Tony Hursh -
Genner, this is an AppleScript, so it only runs under OS X, but the AppleScript is just a wrapper for the Unix commands.

Basically all your Unix shell script needs to do is cd to the right directory (i.e., /mod/chat), then run php chatd.php --start. Nothing to it, really.

Say you have your Moodle installation in /home/moodle. A Unix shell script to start the chat daemon might look something like:

#! /bin/sh
cd /home/moodle/mod/chat
php chatd.php --start &


That's it. smile

Now, you'll need to arrange for this script to run every time your system is restarted or the chat daemon is killed. See Martin's suggestion above on how to do that.

We're very pleased with the performance of the chat daemon, by the way. We gave it a good solid workout last night, and it worked beautifully.
In reply to Tony Hursh

Re: Chat server port, TCP or UDP?

by Genner Cerna -

I see, do you mean to say everytime the server goes down I have to start the chat manually, is there a way to place it on boot section or system init...

In reply to Genner Cerna

Re: Chat server port, TCP or UDP?

by Tony Hursh -
Is there a way to place it on boot section or system init...

Yes, as Martin suggested somewhere in /etc/rc.d or /etc/init.d would be a likely place to put it. The details will vary slightly depending on what flavor of Unix you're running.

Putting something in there is going to require root access to the machine. If you don't have that, another possibility would be some kind of cron job that periodically checks if the server is running and starts it up if it isn't.

In reply to Tony Hursh

Re: Chat server port, TCP or UDP?

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Glad it's working well for you, Tony.  approve  Thanks for funding it! 
In reply to Martin Dougiamas

Re: Chat server port, TCP or UDP?

by Tony Hursh -
You're welcome. We're glad to contribute, and I hope we can do more in the near future.

We had a tough time testing it over the summer break, but now we have plenty of students to hammer on it. smile
In reply to Tony Hursh

Re: Chat server port, TCP or UDP?

by John Papaioannou -
I 'm very very glad to hear that, too! smile

It gave us some really hard times during development...
In reply to John Papaioannou

Re: Chat server port, TCP or UDP?

by Herbert Keijers -
Jon,
Does php has to be compiled with --enable-sockets ?
In reply to Herbert Keijers

Re: Chat server port, TCP or UDP?

by John Papaioannou -
Yes, and in fact chatd.php specifically complains about it if it isn't.
In reply to John Papaioannou

Re: Chat server port, TCP or UDP?

by Herbert Keijers -
Indeed it does smile
Just recompiled php with the sockets option.
Module works great, a lot faster on my testing machine
Thanks.
In reply to Herbert Keijers

Re: Chat server port, TCP or UDP?

by Allan Lee Mesina -

Hello,

I know this is an old post but I found it helpful with my problem. I'm running moodle on Apache /Windows 2000.. Everytime I start the chat daemon withthe php command, I get the following error..

Error: Function socket_setopt<> does not exist.
Possible PHP has not been compiled with --enable-sockets.

How do I recompile PHP to enable sockets?

Alson,. while I'm at it, when chatting in normal mode, the chat does not archive sessions. Any ideas why? I'm using moodle 1.4+ on Windows.

Thanks in Advance.

In reply to Allan Lee Mesina

Re: Chat server port, TCP or UDP?

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
On Windows you have to enable sockets in php.ini. Remember that you should  use CLI binary to launch php from command line.

I will add some info to README after finishing my updates in 1.5dev.

skodak
In reply to John Papaioannou

Re: Chat server port, TCP or UDP?

by Tony Hursh -
Thanks for all your hard work, Jon. Our test involved ~15 students in Moodle chat at the same time that ~20 students from another class were listening to live Shoutcast audio streams being served by the same server. No problems, no slowdowns, and no complaints from anybody. Excellent. smile

In reply to Tony Hursh

Re: Chat server port, TCP or UDP?

by John Papaioannou -
Thank you. I 'm very glad to hear that, too!

However, whenever my more masochistic and inquisitive self takes over, I wonder how it would do with LOTS of students at the same time... say several hundred... thoughtful

Bah, best to leave it alone! wink

In reply to John Papaioannou

Re: Chat server port, TCP or UDP?

by Tony Hursh -
Several hundred would scary from a facilitator standpoint as well as a technical one. smile
In reply to Tony Hursh

Re: Chat server port, TCP or UDP?

by Birdie Newborn -
That would be me. Now I have to learn to use Applescript mixed
In reply to Birdie Newborn

Re: Chat server port, TCP or UDP?

by Tony Hursh -
Actually the AppleScript just shows up as an icon that you double-click, so you don't really need any knowledge of AppleScript to use it (although AppleScript is quite nifty and very useful for a Mac user to know).

You shouldn't need to edit the script if everything is installed in the normal location on your OS X machine. Unfortunately I'm at home for the Labor Day weekend now and won't be back in my office until next Tuesday. I'll try to remember to post the script then.
In reply to Birdie Newborn

Re: Chat server port, TCP or UDP?

by Tony Hursh -
Hi, Birdie. The script should be attached. The Stuffit archive contains two files. RunMoodleChatServer (no extension) will start up the chat server on an OS X machine, assuming that everything is installed in the standard location. RunMoodleChatServer.scpt is the source code for the script. You won't need that unless your Moodle installation is somewhere other than the default folder for the Apache installation on OS X, but if it is you can double-click it to open the script editor and fix it.

If you have any problems or it doesn't work for you, please let me know.

After you're sure the script is working, you may want to put it in your Startup Items.

Enjoy!



In reply to Tony Hursh

Re: Chat server port, TCP or UDP?

by Genner Cerna -

How about in linux? Is this correct?

Under /etc/rc.d/rc.local I added this lines:

cd /home/moodle/mod/chat
php chatd.php --start &

In reply to Genner Cerna

Re: Chat server port, TCP or UDP?

by Tim Allen -
That's exactly what I did and it seems to be working well.  smile 
In reply to Tim Allen

Re: Chat server port, TCP or UDP?

by Genner Cerna -

I hope Martin should include this in chat read me file for linux users...

Hope this helps...

In reply to Tim Allen

Starting Chat Daemon

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
Using SSH, I started the Chat Daemon but got the following error...

jailshell-2.05a$ Moodle chat daemon v1.0 on PHP 4.3.8 ($Id: chatd.php,v 1.13.2.8
2004/08/26 09:57:58 defacer Exp $)

Warning: main(../../config.php): failed to open stream: Permission denied in /ho
me/baillie/public_html/moodle/mod/chat/chatd.php on line 29

Warning: main(): Failed opening '../../config.php' for inclusion (include_path='
.:/usr/local/lib/php') in /home/baillie/public_html/moodle/mod/chat/chatd.php on
line 29

Fatal error: Call to undefined function:  set_config() in /home/baillie/public_h
tml/moodle/mod/chat/lib.php on line 7

Any clues?
In reply to Jon Bolton

Re: Starting Chat Daemon

by John Papaioannou -
Maybe your jail-ed shell doesn't give you access to the config.php? Maybe it's something with the file permissions, like the web server user having access to config.php but you not having such? (chatd will run as your username, not as the webserver user like all of Moodle does)

Jon