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

Home » Public Forums » archive » problems fetching data via the internet (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
problems fetching data via the internet (socket) [message #41744] Thu, 18 November 2004 07:49
nunoragil is currently offline  nunoragil
Messages: 3
Registered: November 2004
Junior Member
Dear listers,
I've written the below piece of IDL code to connect to a remote server
and fetch some data (images in this case).
The problem that I'm having with it is that the requests I'm testing
(the first and second ones) work if I copy and paste them directly to
a browser. Within the script, they manage to create a dtm.tif file
with 1kb only.
Why is this happening? Why does the requests work in a browser but do
not work in the script?
The third request works both in the script and in the browser...
Any help would be much appreciated.
Regards,
Nuno

pro test
; getRequest='GET iceds.ge.ucl.ac.uk/cgi-bin/wcs?REQUEST=GetCoverage&COVER AGE=srtm&SERVICE=WCS&'+
$
; 'map=wcs_srtm.map&BBOX=43.9,-18.9,44.4,-18.4'+ $
; '&FORMAT=GEOTIFF&CRS=EPSG:4326&RESX=0.00083333&a mp;RESY=0.00083333'

getRequest='GET iceds.ge.ucl.ac.uk/cgi-bin/wcs?REQUEST=GetCoverage&COVER AGE=l5&'+$
'SERVICE=WCS&map=wcs_land1.map&BBOX=43.9,-18.9,44.4, -18.4&'+$
'FORMAT=GEOTIFF&CRS=EPSG:4326&RESX=0.00027778&RE SY=0.00027778'

; getRequest='GET http://iceds.ge.ucl.ac.uk:8080/deegree/wcs?service=WCS&r equest=GetCoverage&version=1.0.0&Layer=DD_madab3'+
$
; '&SRS=EPSG:4326&BBOX=43.9,-18.9,44.4,-18.4&Width =800&Height=800'+ $
; '&Format=tif'


; Establishes the connection port, change with above request
port=80

; Establishes the connection with the server
SOCKET, unit, 'iceds.ge.ucl.ac.uk', port, /GET_LUN, ERR=err

IF err NE 0 THEN BEGIN
print,'SOCKET error ...'
ENDIF ELSE BEGIN
print,'SOCKET OK ...'
ENDELSE

; Sends the request to the server
PRINTF, unit, getRequest

; Creates a file for writing
OPENW,img, 'c:\dtm.tif', /GET
byte_in = 0B
; Reads the data from the server and writes it to a temporary file on
the hard disk
; This is done Byte by Byte
WHILE EOF(unit) EQ 0 DO BEGIN
READU, unit, byte_in
WRITEU,img,byte_in
ENDWHILE
print, 'done'
; Dealocates file units and closes all files
FREE_LUN, unit, img
CLOSE, /ALL
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Some Object Oriented Programming Books
Next Topic: Using !P.Multi for TVSCL,CONGRID

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

Current Time: Wed Oct 08 20:01:14 PDT 2025

Total time taken to generate the page: 0.07136 seconds