Re: Tkx socket server can't read input

[email protected] (Kevin Walzer) Wed, 03 Apr 2013 22:56:24 -0400
Newsgroups perl.tcltk
Organization WordTech Communications LLC
Message-ID <[email protected]>
On 4/3/13 7:02 AM, Konovalov, Vadim (Vadim)** CTR ** wrote:
> sub handle_connection {
>       my ($client) = shift;
>       my $message = Tkx::gets($client);
>       if ( !Tkx::eof($client) ) {
>           $message =~ s/[\r\n]+$//;
>           $log->insert( 'end', "$message\n" );
>       }
>       else {
>           print "connection closed\n";
>           $log->insert( 'end', "connection closed\n" );
>           eval {Tkx::close($client);}; ## this was incorrect - $client->close();
>       }
>       $log->see('end');
> }

Indeed--this works better. Thank you.

This is also the solution to my earlier discussion, a month or so ago, 
about using XMLRPC as a form of IPC between Tkx and other apps. Turns 
out that the canonical Tcl socket approach, exposed from Perl, is not 
only simpler but optimal. What a nice discovery.

Now, as soon as I get an Apple Event dispatching mechanism working via 
SWIG, I think I'll be good to go in developing a Perl-Tkx app for the 
Mac that is commercial quality...

-- 
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com