Re: Socket! [message #23378] |
Wed, 24 January 2001 13:30 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Craig Markwardt <craigmnet@cow.physics.wisc.edu> writes:
>
... discussion of FTP over and HTTP in IDL
> I think Ron is right, SOCKET is a great opportunity for users to do
> their own interprocess communication, but if you need some of the
> standard protocols then seek outside library help. Also, it should be
> fairly easy to implement the HTTP protocol. Try this to get yourself
> started:
... example program
>
Here I am replying to my own post. I must be half-way to loony!
Apparently the FTP protocol does support a "passive" technique which
may be easier to implement within IDL, but it still does require
implementing the protocol in IDL. Also I am told that my HTTP example
may have been too simple (at least it's a starting point).
I think there is hope that a future version of IDL may have an
implementation of these protocols, thus saving us the trouble.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: Socket! [message #23380 is a reply to message #23378] |
Wed, 24 January 2001 12:28  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
landsman@my-deja.com writes:
> Has anyone tried to use the Unix/Windows SOCKET procedure in IDL V5.4,
> or thought about ways that it might be useful? It looks to me like
> it should allow one to read a file on an anonymous FTP server, but I
> haven't figured out the syntax for this. (I have no previous socket
> programming experience in other languages, so I am proceeding
> naively...)
>
> For example, I can open a socket to an anonymous FTP account on a
> machine named 'ftpservername'
>
> IDL> socket, 1, 'ftpservername', 'ftp'
>
> and read the welcome message
>
> IDL> text = ''
> IDL> readf,1,text & print,text
>
> but I haven't figured out the syntax for reading a file on
> the FTP server. I'd also be interested in hearing of other possible
> applications for the SOCKET procedure. Is it mainly for use with a C
> interface, or is it useful in pure IDL applications?
FTP is a particularly unsuitable protocol because it requires a
*separate* connection for data exchange. The socket you opened is
simply the control connection. It may be very difficult to implement
this particular protocol in IDL since it requires the client, you, to
"listen" on the data socket, and I am not sure that SOCKET supports
that.
From my chance to play with SOCKET, the telnet protocol does seem to
be implemented, so users are spared from doing the complicated and
arcane telnet negotiation. If you want something FTP-like you might
try HTTP or TFTP (the "trival" FTP protocol). Anyway you cut it, you
will probably need to implement the raw protocol.
I think Ron is right, SOCKET is a great opportunity for users to do
their own interprocess communication, but if you need some of the
standard protocols then seek outside library help. Also, it should be
fairly easy to implement the HTTP protocol. Try this to get yourself
started:
socket, unit, 'cow.physics.wisc.edu', 80, /get_lun
printf, unit, 'GET http://cow.physics.wisc.edu/~craigm/idl/idl.html'
text = ''
while eof(unit) EQ 0 do begin
readf, unit, text
print, text
endwhile
free_lun, unit
Happy socketing,
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: Socket! [message #23385 is a reply to message #23380] |
Wed, 24 January 2001 04:56  |
ronn
Messages: 123 Registered: April 1999
|
Senior Member |
|
|
in article 94m3t3$joa$1@nnrp1.deja.com, landsman@my-deja.com at
landsman@my-deja.com wrote on 1/24/01 12:31 AM:
> Has anyone tried to use the Unix/Windows SOCKET procedure in IDL V5.4,
> or thought about ways that it might be useful? It looks to me like
> it should allow one to read a file on an anonymous FTP server, but I
> haven't figured out the syntax for this. (I have no previous socket
> programming experience in other languages, so I am proceeding
> naively...)
>
I have experimented some with it, but I prefer to use Randall Franks
implementation of sockets (The dll is on my web site at
http://www.rlkling.com/freeware/dlms.htm ).
But yes, sockets are extremely useful for both pure IDL and interfacing with
C programs. I recently helped someone who wanted to run a mix of IDL and C
applications on different machines and pass the results back to a "master"
IDL program for compilation and display. So you can use these to implement a
parallel processing architecture (Shameless plug coming... If anyone is
interested in doing parallel processing with IDL I have something up and
running, just contact me.)
I expect, but haven't tried it, that sockets would be great for applications
that need to access real time information over the web. Something like
weather or stock market data comes to mind.
-Ronn
--
Ronn Kling
Ronn Kling Consulting
email: ronn@rlkling.com
"Application Development with IDL"� programming book updated for IDL5.4!
"Calling C from IDL, Using DLM's to extend you IDL code" NEW BOOK!
Shareware and Freeware at: http://www.rlkling.com/
|
|
|