Module: LuaSocket

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Ted Sullivan
    Indigo Rose Staff Member
    • Oct 2003
    • 960

    Module: LuaSocket

    LuaSocket is a Lua extension library that is composed by two parts: a C core that provides support for the TCP and UDP transport layers, and a set of Lua modules that add support for functionality commonly needed by applications that deal with the Internet.

    The core support has been implemented so that it is both efficient and simple to use. It is available to any Lua application once it has been properly initialized by the interpreter in use. The code has been tested and runs well on several Windows and Unix platforms.

    Among the support modules, the most commonly used implement the SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading files) client protocols. These provide a very natural and generic interface to the functionality defined by each protocol. In addition, you will find that the MIME (common encodings), URL (anything you could possible want to do with one) and LTN12 (filters, sinks, sources and pumps) modules can be very handy.

    [b]Download[b]
    Get it here: http://www.autoplaymediastudio.com/d...luasocket.html

    Installation
    Here is how to make the LuaSocket Lua module available to your AutoPlay Media Studio 8 project.

    1. Download the Lua module and extract it to a temporary location.
    2. Copy the contents of the "lua" folder to your project's Scripts folder. (Do not place it in a lua subfolder; put it directly inside the Scripts folder.)
    3. Copy the "mime" folder to you project's Scripts folder.
    4. Copy "core.dll" from the socket folder into the existing "socket" folder in your project's Scripts folder.
    5. Add the following requires to your project, e.g. in Global Functions or where they will be used:

    Code:
      -- for the ftp functions
      ftp = require("socket.ftp")      
    
      -- for LTN012 filters sources and sinks
      ltn12 = require("ltn12")         
    
      -- for the http functions
      http = require("socket.http")    
    
      -- for filters that apply and remove common content transfer encodings
      mime = require("mime")           
    
      -- for functionality to send e-mail messages
      smtp = require("socket.smtp")    
    
      -- for the core functionality of LuaSocket
      socket = require("socket")       
    
      -- for functions to parse, protect, and build URLs, as well
      -- as functions to compose absolute URLs from base and relative URLs
      url = require("socket.url")
    Usage
    The functions are documented here:


    Example

    Code:
    -- Show the debug window.
    Debug.ShowWindow(true);
    
    -- Print the socket version to the debug window.
    socket = require("socket")
    Debug.Print("Socket Version: "..socket._VERSION.."\r\n\r\n");
    
    -- Print the html source of the URL to the debug window.
    http = require("socket.http")
    strWebSource = http.request("http://www.cs.princeton.edu/~diego/professional/luasocket");
    Debug.Print(strWebSource);
    Credits
    Copyright 2004-2007 Diego Nehab. All rights reserved.
    LuaSocket is free software and uses the same license as Lua.
    New Release: Setup Factory 9.6 adds Windows 11 compatibility and support for hardware token OV/EV Code Signing certificates.
  • Lucrian
    Indigo Rose Customer
    • Sep 2006
    • 24

    #2
    The link for download is broken. Any other link for AMS 8 ?
    Thank you!

    Comment

    • Ulrich
      Indigo Rose Staff Member
      • Apr 2005
      • 5131

      #3
      I believe that you still can get the files here: http://files.luaforge.net/releases/l...uasocket-2.0.2

      Ulrich

      Comment

      Working...
      X