Nearly: bash spawn expect and dns-sd

Andre Garzia andre at andregarzia.com
Fri Jan 28 13:27:08 EST 2011


David,

I, Andre Alves Garzia, Bailiff of Hacks give you the following solution:

for registering: use tempname() to obtain a safe file. Output bash
script into tempfile. Chmod +x tempfile and then execute it.

for listening: same trick as before but redirect all output of the
command to text file such as:

dns-sd -L 'LiveCode Port Mapper'_livecode._udp. . >> mylog.txt 2>&1

then keep a send in time loop reading mylog.txt for new data.

Andre

On Fri, Jan 28, 2011 at 3:58 PM, David Bovill <david at vaudevillecourt.tv> wrote:
>
> Not quite able to get this cross platform command line to work for Bonjour -
> it hangs around waiting for input. I've tried open process and that nearly
> works, but think this is the way to go:
>
> set expectCode to "
> > spawn -noecho dns-sd -B _ssh._tcp
> > expect -timeout 5 eof {}
> > "
> > do shell script "echo " & quoted form of expectCode & "|/usr/bin/expect -f
> > -"
> >
>
> It's an AppleScript... but I'm not quite getting it. This is what I want to
> do:
>
>   1. Register a service - "dns-sd -R 'LiveCode Port Mapper' _livecode._udp.
>   . 45000 pdl=application/livecode" does this on the command line but waits
>   around
>   2. List services available - "dns-sd -L 'LiveCode Port Mapper'
>   _livecode._udp. ." does this on the command line
>
> But I want to use LiveCode's shell (or open process) for this - any ideas?
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



--
http://www.andregarzia.com All We Do Is Code.




More information about the use-livecode mailing list