Node:Internet Socket Client, Next:, Up:Internet Socket Examples Internet Socket Client Example

The following example demonstrates an Internet socket client. It connects to the HTTP daemon running on the local machine and returns the contents of the root index URL.

(let ((s (socket AF_INET SOCK_STREAM 0)))
  (connect s AF_INET (inet-aton "") 80)
  (display "GET / HTTP/1.0\r\n\r\n" s)

  (do ((line (read-line s) (read-line s)))
      ((eof-object? line))
    (display line)