Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Porting a native Tcl/Tk app to be a plug-in tcllet (reformatted)

0 views
Skip to first unread message

Greg Stevens

unread,
Oct 25, 1996, 3:00:00 AM10/25/96
to

Sorry. Ignore the first post. I reformatted this one so you can read it!

Hello:
Excuse me if this is a naive post or the wrong newsgroup but I am
new to the Tcl/Tk/Java/plug-in/applet stuff. Here is our situation:

We have some existing Tcl/Tk apps that we want to be able to use via
Web browsers and leverage as much of the Tcl/Tk code that we already
have. These GUI clients talk to a server via TCP/IP. As I understand
it, we have three options. The first is as follows:

Use the Tcl/Tk plug-in for the GUI part of the client and "port" the
networking portion of it (currently in "C") to be CGI based apps that
communicate with our server. This seems to be the least amount of work
since we could embed the networking portion mentioned above into the
Web server via a DLL/shared library. This approach does not seem to be
too efficient because of using the Web server as a "middleman". This is
pictured below:

Netscape Browser Web Server Machine Our Server Machine
|--------------| |----------------------------| |------------|
|Tcl/Tk Plug-in| | | | |
| ------------ | | ------------ ----------- | | ---------- |
| | | | | | | | Our | | | | | |
| | Our | |HTTP| |Web Server|CGI| Network | |TCP/IP| | Our | |
| | Applet | |<-->| | (HTTPD) |<->| Comm. | |<---->| | Server | |
| | | | | | | | Scripts | | | | | |
| ------------ | | ------------ ----------- | | ---------- |
| | | | | |
|--------------| |----------------------------| |------------|
Note: "Our CGI Scripts" could Note: "Our Server"
be embedded in the HTTPD. may run on the
same machine as
the HTTPD.

The second option would be to have the Tcl/Tk client talk directly
to our server eliminating the need to have the Web server/CGI as a
"proxy" in the middle. But my question is: Can a Tcl/Tk applet use the
Tcl "socket" call to talk TCP/IP from within the Netscape Browser to
another machine? I understand this cannot be done with the security
policy implemented in the v1 release of Safe-Tcl in the plug-in. I also
understand that the v2 release will have a tailorable security policy.
Will I be able to enable the "socket" call with it? This approach would
be a little more work since we would have to "port" our networking
portion from "C" to Tcl. This is pictured below:

Netscape Browser Our Server Machine
|--------------| |------------|
|Tcl/Tk Plug-in| | |
| ------------ | | ---------- |
| | | | | | | |
| | Our | |TCP/IP| | Our | |
| | Applet | |<---->| | Server | |
| | | | | | | |
| ------------ | | --------- |
| | | |
|--------------| |------------|

The third option would be to write our own Netscape plug-in that
would do the networking communication with our server. If this is
feasible it leads me to another question: Can our networking
communications plug-in talk to our Tcl/Tk applet and vise-versa? This
approach would be the most amount of work since we would have to
develop a Netscape plug-in to do our network communications. This
option is pictured below:

Netscape Browser Our Server Machine
|----------------------------------------| |------------|
|Tcl/Tk Plug-in Our Plug-in | | |
| ------------ ---------- | | ---------- |
| | |Netscape Plug-in| Our | | | | | |
| | Our | API? | Network| |TCP/IP| | Our | |
| | Applet |<-------------->| Comm. | |<---->| | Server | |
| | | | Applet | | | | | |
| ------------ ---------- | | --------- |
| | | |
|----------------------------------------| |------------|

Are there any other options? Am I missing something obvious? Which
is the better architecture? Should we redo the whole thing in
Java/JavaScript? :( Thanks in advance for your replys!

Regards,
Greg

--
Gregory L. Stevens, Sr. Software Engineer gste...@cisco.com
Cisco Systems, Inc. Internet Business Unit www.tgv.cisco.com/~gstevens
101 Cooper Street Phone:(408)457-5355 FAX:5208
Santa Cruz, CA 95060-4526 US Pager:(408)697-0413

Jeffrey Hobbs

unread,
Oct 25, 1996, 3:00:00 AM10/25/96
to

In article <327112...@cisco.com>, Greg Stevens <gste...@cisco.com> wrote:
> Use the Tcl/Tk plug-in for the GUI part of the client and "port" the
>networking portion of it (currently in "C") to be CGI based apps that
....

>Web server via a DLL/shared library. This approach does not seem to be
>too efficient because of using the Web server as a "middleman". This is

No, this would not be too efficient, but I think you can leverage the
capabilities of Tcl to do nearly the same without massive rewriting.
See below.

> The second option would be to have the Tcl/Tk client talk directly
>to our server eliminating the need to have the Web server/CGI as a
>"proxy" in the middle. But my question is: Can a Tcl/Tk applet use the
>Tcl "socket" call to talk TCP/IP from within the Netscape Browser to

OK, as of v1 of the plugin, you'd have to manually replace the default
security policy with one that supported the 'socket' command, and perhaps
the 'load' command as well. v2 should be (we hope) fully configurable by
the user (all shades of gray from full safe-tcl to full open-tcl).

With socket available, you should be able to directly communicate with your
server (which is the way it should be). If you require the C code to do the
networking (like you are dealing with embedded NULLs and such), then you can
also make use of 'load' in loading a DLL into your applet. This can be done
when the security policy allows it. The only trick is that you have to get
the right DLL for the system. If you only run this on Windows, then you
won't have a problem. Otherwise, you'll have to have a switch which gets
the right version for the system. In that case, I would recommend trying to
use the Tcl socket facilities if possible (because it's system-independent).

> The third option would be to write our own Netscape plug-in that
>would do the networking communication with our server. If this is

I think this is just a modification of using 'load' as above. But FYI,
Jacob hopes to have facilities to communicate between Tcl & Java (or
JavaScript) with v2 of the plugin.

--
Jeffrey Hobbs office: 541.683.7891
Nomad of the 'Net email: jho...@cs.uoregon.edu
URL: http://www.cs.uoregon.edu/~jhobbs/

0 new messages