SPAWN and reading from a socket? [message #7751] |
Thu, 16 January 1997 00:00  |
alpha
Messages: 49 Registered: September 1996
|
Member |
|
|
Hello,
i want to read data directly from a TCPIP-port to get
data into IDL..
are there any better possibilities than spawning an
c-programm which feeds the data into idl?
wasn't there something like named pipes?
Or can I read from a /dev/file directly?
pro get_data
get_lun,unit
spawn,'netcat -l -h otherhost -p dataport ',unit=unit
readu,unit,data
free_lun,unit
print, data
end
any hint needed...
Hendrik
--
Panther in the Jungle __..--''``\--....___ _..,_
-BELIEVE AND DECEIVE- _.-' .-/"; ` ``<._ ``-+'~=.
http://www.ang-physik _.-' _..--.'_ \ `(^) )
.uni-kiel.de/~hendrik ((..-' (< _ ;_..__ ; `'
|
|
|
Re: SPAWN and reading from a socket? [message #7889 is a reply to message #7751] |
Fri, 17 January 1997 00:00   |
alpha
Messages: 49 Registered: September 1996
|
Member |
|
|
Hallo,
da der Mailer wohl nicht ging, per Posting,
sorry Folks!
Panther
|------------------------- Message log follows: -------------------------|
no valid recipients were found for this message
|------------------------- Failed addresses follow: ---------------------|
<plugge@biv7.sr.fht-mannheim.de> ... unknown host
|------------------------- Message text follows: ------------------------|
> In article <5blomp$er@jungle.toppoint.de>, alpha@jungle.toppoint.de (Hendrik Roepcke)
> writes:
> |>Hello,
> |>i want to read data directly from a TCPIP-port to get
> |>data into IDL..
> |>are there any better possibilities than spawning an
> |>c-programm which feeds the data into idl?
> |>wasn't there something like named pipes?
> |>Or can I read from a /dev/file directly?
> |>pro get_data
> |>get_lun,unit
> |>spawn,'netcat -l -h otherhost -p dataport ',unit=unit
> |>readu,unit,data
> |>free_lun,unit
> |>print, data
> |>end
> ich habe vor einiger Zeit ein Prograemmchen geschrieben, das (fuer die Steuerung
> unserer Videokamera) den ganzen Krempel ueber einen call_external()-Aufruf macht.
> Falls Du Interesse hast, kann ich Dir die Sachen mal schicken. Betriebsystem ist zwar
> VMS, aber es sollte sich leicht umschreiben lassen.
> Viele Gruesse
> Michel
>
wir entwickeln auf VMS und auf Digital Unix! Ich wuerde mich ueber den Source daher
SEHR (!) freuen...
vielen Dank
HEndrik
--
Panther in the Jungle __..--''``\--....___ _..,_
-BELIEVE AND DECEIVE- _.-' .-/"; ` ``<._ ``-+'~=.
http://www.ang-physik _.-' _..--.'_ \ `(^) )
.uni-kiel.de/~hendrik ((..-' (< _ ;_..__ ; `'
|
|
|
Re: SPAWN and reading from a socket? [message #7895 is a reply to message #7751] |
Fri, 17 January 1997 00:00   |
plugge
Messages: 17 Registered: May 1995
|
Junior Member |
|
|
In article <5blomp$er@jungle.toppoint.de>, alpha@jungle.toppoint.de (Hendrik
Roepcke) writes:
|>Hello,
|>
|>i want to read data directly from a TCPIP-port to get
|>data into IDL..
|>
|>are there any better possibilities than spawning an
|>c-programm which feeds the data into idl?
|>
|>wasn't there something like named pipes?
|>Or can I read from a /dev/file directly?
|>
|>
|>pro get_data
|>
|>get_lun,unit
|>
|>spawn,'netcat -l -h otherhost -p dataport ',unit=unit
|>
|>
|>readu,unit,data
|>
|>free_lun,unit
|>
|>print, data
|>
|>end
|>
|>
|>any hint needed...
Hendrik,
some time ago I wrote a little program to do that job by
call_external (OS is VMS). If you are interested, let me know.
Michel
|
|
|
Re: SPAWN [message #8668 is a reply to message #7751] |
Wed, 09 April 1997 00:00  |
Tim Patterson
Messages: 65 Registered: October 1995
|
Member |
|
|
Nobuyuki Tasaka wrote:
>
>
> CALL_EXTERNAL (and LINKIMAGE also) is useful to link C routines
> but needs to change codes to be portable to other systems, say,
> from SunOS 4.1.3 to Solaris 2.5 or SGI etc. SPAWN is slow for
> parsing data but there is no fear of this kind of problem.
It is true that you will need to recompile your shareable
libray of C code for different platforms, but you have to
recompile your C code anyway. I am currently using the same
C and Fortran routines called from IDL on SunOS, Solaris, HP
and OSF machines (and I think they should also work on
an SGI platform). The only change I had to make was to get the
HP compiler to use the same naming convention as the otehr platforms
(and this is a compiler option).
It was also reasonably easy to port this to VMS. I think the SPAWN
routine may be harder to change for this OS, but that may not be
a problem.
> In my case, I'm transferring the main portion of data to memory
> map file by C routine, and this file is readable as a normal file
> for any other applications.
>
> My concern is how to use SPAWN for parsing list and errors from
> that C routine to IDL, data size of which are not so large.
>
I'm farid I've really avoided using SPAWN for this type of activity,
mainly because I nbeed the code to be more portable. I'll be interested
in seeing what otehr people have to say about using SPAWN in this
way though. I'm always willing to learn something new :)
Tim
|
|
|
Re: SPAWN [message #8669 is a reply to message #7751] |
Wed, 09 April 1997 00:00  |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
Nobuyuki Tasaka <tasaka@mr.med.ge.com> writes:
> Hi all,
> If someone who have tried to compare SPAWN in the following
> usage, please let me know the difference in terms of data
> parsing speed, interface flexibility and routine's independency.
> I would like to use SPAWN for calling database retriving routine
> written in C.
> 1) SPAWN, "cmd", result
> 2) SPAWN, "cmd", /UNIT
This is not a correct usage. The UNIT keyword returns a logical unit number
which can be used to communicate with the spawned process using read and write
commands (via a bi-directional pipe). Thus, one would want to use this with
the syntax:
SPAWN, "cmd", UNIT=UNIT
When one is done, then one can use
FREE_LUN, UNIT
to close the logical unit, since the SPAWN did an implicit GET_LUN.
I've never used this myself, but I would guess that the spawned program would
communicate with IDL using standard input and output.
Another option you haven't discussed is the use of the /NOSHELL keyword with
SPAWN. This is supposed to speed it up.
Bill
|
|
|
Re: SPAWN [message #8670 is a reply to message #7751] |
Wed, 09 April 1997 00:00  |
Nobuyuki Tasaka
Messages: 2 Registered: April 1997
|
Junior Member |
|
|
Hi Tim,
Tim Patterson wrote:
>
> Hi Nobu,
>
> If you have database retrieval routines already in C,
> have you thought about using CALL_EXTERNAL to link
> the C routines directly into your IDL code and save you
> having to use SPAWNs which will likely be slower.
>
> There's a lot of examples out there for calling up C from
> IDL and it's now a relatively simple thing to set up on
> most platforms.
>
> Tim
Thanks for your recommendation.
CALL_EXTERNAL (and LINKIMAGE also) is useful to link C routines
but needs to change codes to be portable to other systems, say,
from SunOS 4.1.3 to Solaris 2.5 or SGI etc. SPAWN is slow for
parsing data but there is no fear of this kind of problem.
In my case, I'm transferring the main portion of data to memory
map file by C routine, and this file is readable as a normal file
for any other applications.
My concern is how to use SPAWN for parsing list and errors from
that C routine to IDL, data size of which are not so large.
Please let me know your opinion.
Nobu
---------------------------------
Nobuyuki Tasaka
GE Medical Systems
3200 N Grandview Blvd,
Waukesha, WI 53188
(Phone) 414-521-6577
(E-mail) tasaka@mr.med.ge.com
---------------------------------
|
|
|
Re: SPAWN [message #8681 is a reply to message #7751] |
Tue, 08 April 1997 00:00  |
Tim Patterson
Messages: 65 Registered: October 1995
|
Member |
|
|
Hi Nobu,
If you have database retrieval routines already in C,
have you thought about using CALL_EXTERNAL to link
the C routines directly into your IDL code and save you
having to use SPAWNs which will likely be slower.
There's a lot of examples out there for calling up C from
IDL and it's now a relatively simple thing to set up on
most platforms.
Tim
Nobuyuki Tasaka wrote:
>
> Hi all,
>
> If someone who have tried to compare SPAWN in the following
> usage, please let me know the difference in terms of data
> parsing speed, interface flexibility and routine's independency.
>
> I would like to use SPAWN for calling database retriving routine
> written in C.
>
> 1) SPAWN, "cmd", result
>
> 2) SPAWN, "cmd", /UNIT
>
> 3) SPAWN, "cmd"
> (C routine writes data to memory map file and then IDL read it
> as a Logical Unit File)
>
> I'm looking forward to your help.
> Nobu
>
> ---------------------------------
> Nobuyuki Tasaka
> GE Medical Systems
> 3200 N Grandview Blvd,
> Waukesha, WI 53188
> (Phone) 414-521-6577
> (E-mail) tasaka@mr.med.ge.com
> ---------------------------------
--
Dr.Feelgood's Amazing And Marvellous Poetic Panacea
Guaranteed To Cure All Ailments Of The Soul
NO REFUNDS
http://condor.lpl.arizona.edu/~tim/
|
|
|