This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Enabling use of UDP sockets

Help for those learning Tcl or writing their own scripts.
Post Reply
n
na85
Voice
Posts: 5
Joined: Thu Jan 29, 2009 11:46 pm

Enabling use of UDP sockets

Post by na85 »

Hi everyone. Been searching but can't find the answer to my question.

I want to write a script that sends a simple hex-encoded string via UDP to a particular server. Obviously, Tcl and Eggdrop don't have UDP support.

I've found this link on tcl.tk but I'm still fuzzy on how to actually allow eggdrop to use a udp socket.

Do I need to somehow recompile eggdrop with the tcludp library?

Do I need to ask my shell provider to add the tcludp library to the system?

Would it be easier/possible to write a one-off proc in C?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

The linked examples make use of the "Tcl UDP" extension for tcl. There are pre-built modules for windows, however for linux/un*x you'll have to build it against your tcl-library (not against eggdrop).
Generally, you wouldn't have to rebuild your eggdrop for adding new tcl-modules (unlike eggdrop-modules), though you might have to tell tcl where to look for it. Some experience in building/installing custom tcl-modules would be advisable.
NML_375
n
na85
Voice
Posts: 5
Joined: Thu Jan 29, 2009 11:46 pm

Post by na85 »

Hi, thanks for the reply.
nml375 wrote:The linked examples make use of the "Tcl UDP" extension for tcl. There are pre-built modules for windows, however for linux/un*x you'll have to build it against your tcl-library (not against eggdrop).
Generally, you wouldn't have to rebuild your eggdrop for adding new tcl-modules (unlike eggdrop-modules), though you might have to tell tcl where to look for it. Some experience in building/installing custom tcl-modules would be advisable.
So... I haven't asked them yet, but since I'm running eggdrop on one of my shells, wouldn't my provider have to install that?

If that's true, wouldn't it be easier/more feasible to just write a new tcl command in C?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

That kind of depends on how the system has been set up, which packages and tools are available, etc.
The extension is not compiled into the tcl-libraries, but merely compiled for it. The tcl environment would then load it into the runtime using the "load" command (usually handled by the packet manager, hence you see the "package require udp" command in the beginning of the example scripts).
To install it yourself, you'd most likely have to place the generated library file within your home directory. You would also need a standard compiling environment, including the tcl libraries (including the "devel" parts).
NML_375
Post Reply