Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.networking > #2053

Mental-model of multiprocessing?

From Avoid9Pdf@gmail.com
Newsgroups comp.os.linux.networking, comp.os.linux.misc
Subject Mental-model of multiprocessing?
Date 2013-03-27 11:13 +0000
Organization A noiseless patient Spider
Message-ID <kiuk8p$4is$1@dont-email.me> (permalink)

Cross-posted to 2 groups.

Show all headers | View raw


For someone who knows the stacked-subroutine-calling mechanism
[down to the silicon level], and resists the little-men-in-the-box
mental model, it's difficult to UNDERSTAND how to build a script that:
  calls a URL via openssl,
  conducts a dialog with the remote server,
  and saves the log of the process in a file.
--
  My main difficulty seems to be that apparently the 'routines'
  are NOT stacked:
  User's shell > Script > openssl > REPEAT{dialog; log}.
  The dialog-steps must be <WRAPPED> in the openssl.
  
  How does openssl know when to <return>?
  
  Here's a snipppet of related script which I don't understand:---
  # Author Pascal B..
  local_name=localhost
  if [ "$1" = "--log" ] ; then shift ; trace=echo ; else trace=true ; fi
 log=/dev/tty
  message=/tmp/message.$$
  cat>$message
(
    read line 0<&3 ; $trace "$line">$log
    case "$line" in 2*) ;; *) echo "QUIT" 1>&3 ; exit 0 ;; esac
    echo "HELO $local_name" 1>&3
    read line 0<&3 ; $trace "$line">$log
    case "$line" in 2*) ;; *) echo "QUIT" 1>&3 ; exit 0 ;; esac
    echo "MAIL FROM: <${from}>" 1>&3
...
    echo "QUIT" 1>&3
) 3<>/dev/tcp/$smtp_server/25 
==== end of script snippet

What's the meaning of:
  cat>/tmp/mesgFile
(
    read line 0<&3 ; echo "$line">$log
    case "$line" in 2*) ;; *) echo "QUIT" 1>&3 ; exit 0 ;; esac
    echo "HELO $local_name" 1>&3
) 3<>/dev/tcp/$smtp_server/25  
??! 

Where's to doco/man for the syntax:-
  cat>/File
  ( <read; select; write> ) 3<>/dev/tcp/URL/PORT
  ??!
  
How is data read from /dev/tty ?

# echo dog > /dev/tty
# cat /dev/tty
# echo dog > /dev/tty ; cat /dev/tty
give unexpected results FOR ME 

/dev/tty seems to behave like $1 AND like $2  ?!?

Apparently my confusion is about 'redirection' ?

So, where's a good mental-model of multiprocessing,
documented?

Thanks for any pointers/explanations.

Back to comp.os.linux.networking | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Mental-model of multiprocessing? Avoid9Pdf@gmail.com - 2013-03-27 11:13 +0000
  Re: Mental-model of multiprocessing? Joe Beanfish <joebeanfish@nospam.duh> - 2013-03-27 14:02 +0000
    Re: Mental-model of multiprocessing? Richard Kettlewell <rjk@greenend.org.uk> - 2013-03-27 14:13 +0000
      Re: Mental-model of multiprocessing? The Natural Philosopher <tnp@invalid.invalid> - 2013-03-27 14:35 +0000
        Re: Mental-model of multiprocessing? Chris Davies <chris-usenet@roaima.co.uk> - 2013-03-27 15:30 +0000
          Re: Mental-model of multiprocessing? The Natural Philosopher <tnp@invalid.invalid> - 2013-03-27 18:57 +0000
        Re: Mental-model of multiprocessing? Richard Kettlewell <rjk@greenend.org.uk> - 2013-03-27 21:15 +0000
          Re: Mental-model of multiprocessing? The Natural Philosopher <tnp@invalid.invalid> - 2013-03-27 21:36 +0000
          Re: Mental-model of multiprocessing? Aragorn <stryder@telenet.be.invalid> - 2013-03-28 06:56 +0100
      Re: Mental-model of multiprocessing? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-03-27 21:47 +0000
    Re: Mental-model of multiprocessing? Avoid9Pdf@gmail.com - 2013-03-29 14:28 +0000
      Re: Mental-model of multiprocessing? The Natural Philosopher <tnp@invalid.invalid> - 2013-03-29 15:32 +0000
        Re: Mental-model of multiprocessing? J G Miller <miller@yoyo.ORG> - 2013-03-29 22:36 +0000
      Re: Mental-model of multiprocessing? Chris Davies <chris-usenet@roaima.co.uk> - 2013-03-29 17:31 +0000
        Re: Mental-model of multiprocessing? Avoid9Pdf@gmail.com - 2013-03-29 21:10 +0000
          Re: Mental-model of multiprocessing? "Chris F.A. Johnson" <cfajohnson@gmail.com> - 2013-03-29 18:55 -0400
            Re: Mental-model of multiprocessing? Unknown <dog@gmail.com> - 2013-03-30 06:01 +0000
          Re: Mental-model of multiprocessing? Chris Davies <chris-usenet@roaima.co.uk> - 2013-03-30 21:28 +0000
          Re: Mental-model of multiprocessing? Joe Beanfish <joebeanfish@nospam.duh> - 2013-04-01 15:32 +0000
            Re: Mental-model of multiprocessing? Unknown <dog@gmail.com> - 2013-04-03 08:00 +0000
              Re: Mental-model of multiprocessing? Joe Beanfish <joebeanfish@nospam.duh> - 2013-04-08 14:47 +0000
            Re: Mental-model of multiprocessing? Unknown <dog@gmail.com> - 2013-04-03 08:02 +0000

csiph-web