comp.lang.ada
 help / color / mirror / Atom feed
* Web-page|socket|my-ada-program
@ 1997-02-28  0:00 Markus Wahl
  1997-03-04  0:00 ` Web-page|socket|my-ada-program Jacob Sparre Andersen
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Wahl @ 1997-02-28  0:00 UTC (permalink / raw)



I need to read not from st-input but from a web-page.
How can that be done.

I have heard someone talk about sockets, but I don't know what it means.

I work on a UNIX system.

/Markus
--
"I would have made a good Pope."
	-- Richard Nixon





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Web-page|socket|my-ada-program
@ 1997-03-01  0:00 Markus Wahl
  1997-03-02  0:00 ` Web-page|socket|my-ada-program Bob Klungle
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Wahl @ 1997-03-01  0:00 UTC (permalink / raw)




I need to read not from st-input but from a web-page.
How can that be done.

I have heard someone talk about sockets, but I don't know what it means.

I work on a UNIX system.

/Markus
--
If you eat a live frog in the morning, nothing worse will happen to
either of you for the rest of the day.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Web-page|socket|my-ada-program
  1997-03-01  0:00 Web-page|socket|my-ada-program Markus Wahl
@ 1997-03-02  0:00 ` Bob Klungle
  0 siblings, 0 replies; 4+ messages in thread
From: Bob Klungle @ 1997-03-02  0:00 UTC (permalink / raw)



You work on a UNIX system and don't know what a socket is???? Read Steven's
book on Network Programming (or any TCP/IP supporting network book.)

cheers..bob

> I need to read not from st-input but from a web-page.
> How can that be done.
> 
> I have heard someone talk about sockets, but I don't know what it means.
> 
> I work on a UNIX system.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Web-page|socket|my-ada-program
  1997-02-28  0:00 Web-page|socket|my-ada-program Markus Wahl
@ 1997-03-04  0:00 ` Jacob Sparre Andersen
  0 siblings, 0 replies; 4+ messages in thread
From: Jacob Sparre Andersen @ 1997-03-04  0:00 UTC (permalink / raw)



Markus Wahl (d95wahl@dtek.chalmers.se) wrote:
 __________
| I need to read not from st-input but from a web-page.
| How can that be done.
 ^^^^^^^^^^
If the web page is on the same machine as the program, it's just to find the
right file name, and then open the file as usual (using Ada.Text_IO.Open).

If you want to access documents through HTTP, you have two options:

1) Download the document to a temporary file using a command line HTTP client
   such as w3c. You'll have to use the C function system to do this (I will
   include an example in this message). When the document is downloaded, you
   just open, read, close, and erase the temporary file.

2) Use a binding to the wwwlib. - You might have to write the binding
   yourself.

|^^^^^^^^^^
| I have heard someone talk about sockets, but I don't know what it means.
 ^^^^^^^^^^
That's a low level UNIX(?) communication system.

Greetings,

Jacob
--
Jacob Sparre Andersen                            http://www.nbi.dk/%7Esparre/
Center for Chaos and Turbulence Studies          Phone: (+45) 39 65 53 51
The Niels Bohr Institute                                (+45) 35 32 53 05
--
MFWT - The new LEGO idea book!                 Contact: sebliss@compuserve.com
------------------------------------------------------------------------------

   procedure Download (URL       : in     String;
                       File_Name : in     String) is

      use Interfaces.C;
      use Interfaces.C.Strings;

      function system (Command : chars_ptr) return Interfaces.C.int;
      pragma Import (C, system);

      Command_In_C_Format : chars_ptr :=
        New_String ("w3c " & URL & " > " & File_Name);

      Error_Code : Interfaces.C.int := system (Command_In_C_Format);

   begin --  Download
      Free (Command_In_C_Format);

      if Error_Code /= 0 then
         Ada.Text_IO.Put_Line
           (File => Ada.Text_IO.Current_Error,
            Item => "Download: system returned " &
                    Interfaces.C.int'Image (Error_Code));
         raise System_Error;
      end if;
   end Download;

------------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-03-04  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-01  0:00 Web-page|socket|my-ada-program Markus Wahl
1997-03-02  0:00 ` Web-page|socket|my-ada-program Bob Klungle
  -- strict thread matches above, loose matches on Subject: below --
1997-02-28  0:00 Web-page|socket|my-ada-program Markus Wahl
1997-03-04  0:00 ` Web-page|socket|my-ada-program Jacob Sparre Andersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox