comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDLnetURL and SOCKET
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDLnetURL and SOCKET [message #89506] Wed, 22 October 2014 12:51 Go to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
Is there a way to open a file unit on a http:// server so that it can be processed with IDL? One can do this with the SOCKET procedure, and I have a program that will open a file on a remote server with SOCKET, which can then be processed with IDL commands (e.g. READU).

http://idlastro.gsfc.nasa.gov/ftp/pro/sockets/webget.pro

The problem is that SOCKET provides no framework for communicating with an http: server (e.g taking care of things like proxy servers, passwords, SSL certificates etc. ) and so I need to write these myself. The IDLNetURL object does take care of most of the http communication protocols and I have happily used it to copy remote files to disk or to a buffer. But I don't believe it is possible to open a remote file with IDLNetURL -- for example, if one just wants to read the first line of a remote file and not read the entire file. So what I think I need is some way to combine SOCKET and IDLnetURL.

Or perhaps I need think about this in a different way. Thanks, --Wayne
Re: IDLnetURL and SOCKET [message #89528 is a reply to message #89506] Thu, 23 October 2014 09:04 Go to previous messageGo to next message
Dominic[2] is currently offline  Dominic[2]
Messages: 3
Registered: October 2014
Junior Member
On Wednesday, October 22, 2014 3:51:13 PM UTC-4, wlandsman wrote:
> Is there a way to open a file unit on a http:// server so that it can be processed with IDL? One can do this with the SOCKET procedure, and I have a program that will open a file on a remote server with SOCKET, which can then be processed with IDL commands (e.g. READU).
>
> http://idlastro.gsfc.nasa.gov/ftp/pro/sockets/webget.pro
>
> The problem is that SOCKET provides no framework for communicating with an http: server (e.g taking care of things like proxy servers, passwords, SSL certificates etc. ) and so I need to write these myself. The IDLNetURL object does take care of most of the http communication protocols and I have happily used it to copy remote files to disk or to a buffer. But I don't believe it is possible to open a remote file with IDLNetURL -- for example, if one just wants to read the first line of a remote file and not read the entire file. So what I think I need is some way to combine SOCKET and IDLnetURL.
>
> Or perhaps I need think about this in a different way. Thanks, --Wayne

Hi Wayne,

Try this:

http://sohowww.nascom.nasa.gov/solarsoft/gen/idl/sockets/web read.pro

If the server supports byte-serving, you can selectively read a range of bytes as follows:

IDL> f= http://sohowww.nascom.nasa.gov/pickoftheweek/Oct_C3_halo.jpg

;-- read whole file

IDL> o=webread(f,response=response)
IDL> print,response
HTTP/1.1 200 OK
Date: Thu, 23 Oct 2014 15:56:15 GMT
Server: Apache/2.4.10 (Unix)
Last-Modified: Fri, 17 Oct 2014 20:05:21 GMT
ETag: "24b46-505a3e28764e6"
Accept-Ranges: bytes
Content-Length: 150342
Content-Type: image/jpeg

;-- read 101 bytes

IDL> o=webread(f,response=response,range=[100,200])
Range: bytes=100-200
IDL> print,response
HTTP/1.1 206 Partial Content
Date: Thu, 23 Oct 2014 15:56:31 GMT
Server: Apache/2.4.10 (Unix)
Last-Modified: Fri, 17 Oct 2014 20:05:21 GMT
ETag: "24b46-505a3e28764e6"
Accept-Ranges: bytes
Content-Length: 101
Content-Range: bytes 100-200/150342
Content-Type: image/jpeg


Dominic
Re: IDLnetURL and SOCKET [message #89529 is a reply to message #89528] Thu, 23 October 2014 11:47 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Thursday, October 23, 2014 12:04:29 PM UTC-4, dmzarro wrote:

>
> Try this:
>
> http://sohowww.nascom.nasa.gov/solarsoft/gen/idl/sockets/web read.pro
>
> If the server supports byte-serving, you can selectively read a range of bytes as follows:
>

Thanks Dominic! That looks very useful.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Fleurdelas - Carbomap's Open Source LiDAR file manipulator - now fully support LAS 1.4 and the Extra Bytes VLR
Next Topic: IDL 8.4 LOADCT performance

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 09:11:55 PDT 2025

Total time taken to generate the page: 0.00369 seconds