lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


We embed a light http library by Steve Kemp. Details in the attachment, exported from the NoteCase Pro Help file.  

Best regards,

Paul
--
[Notice not included in the above original message:  The U.S. National Security Agency neither confirms nor denies that it intercepted this message.]
                                                ¯\_(ツ)_/¯

Virus-free. www.avg.com
Title: Network Commands

Network Commands

This section classifies scriptable program commands related to TCP/IP communication.

The code for these functions was taken from http://www.steve.org.uk/
(made available by the author Steve Kemp under a LGPL license, with explicit allowance by Mr. Kemp to statically link the code in NoteCase Pro).

Original source code can be found here:
http://www.steve.org.uk/Software/lua-httpd/src/libhttpd.c

Modified source code with Windows portability patches can be found here:
http://www.notecasepro.com/download/src/libhttpd.zip



Table of Contents

net.accept
net.bind
net.close
net.connect
net.read
net.write

net.accept

Command

int net.accept(int nSocket)

Command returns the incoming connection socket using the socket that listens on some TCP/IP port.

Parameters:

nSocket -- number of the socket that accepts connections (listening socket)


Usage Examples

[To be added later.]

Command usage is also illustrated in the following sample scripts:

Command has not yet been used in a sample script.


Command History

Command was introduced in v. 3.4.2.

net.bind

Command

int net.bind(int nPort)

Command creates the socket bound to some TCP/IP port (listening socket).

Parameters:

nPort -- number of the port


Usage Examples

[To be added later.]

Command usage is also illustrated in the following sample scripts:

Command has not yet been used in a sample script.


Command History

Command was introduced in v. 3.4.2.

net.close

Command

net.close(int nSocket)

Command closes the TCP/IP socket.

Parameters:

nSocket -- socket number


Usage Examples

[To be added later.]

Command usage is also illustrated in the following sample scripts:

43_HttpTest.lua


Command History

Command was introduced in v. 3.4.2.

net.connect

Command

int net.connect(string strHost, int nPort)

Command establishes outgoing connection to the specified host/port and returns the TCP/IP socket of the connection.

Parameters:

strHost -- host name or IP string (e.g. "www.notecasepro.com")

nPort -- port number (e.g. 80)


Usage Examples

[To be added later.]

Command usage is also illustrated in the following sample scripts:

43_HttpTest.lua


Command History

Command was introduced in v. 3.4.2.

net.read

Command

int, string net.read(int nSocket, int nTimeout)

Command reads up to a 4kB of data from the socket and returns the data size and the data itself.
You can call this command multiple times (in a loop) to fetch more than 4kB of data.

Parameters:

nSocket – connection socket number

nTimeout – connection timeout in milliseconds


Usage Examples

[To be added later.]

Command usage is also illustrated in the following sample scripts:

43_HttpTest.lua


Command History

Command was introduced in v. 3.4.2.
Additional parameter nTimeout was introduced in v. 3.6.1

net.write

Command

net.write(int nSocket, string strData [, int nDataSize])

Command writes specified data to the socket.

Parameters:

nSocket -- connection socket number

strData -- data string

nDataSize -- optional size of data string (if you want to send less than the whole string)


Usage Examples

[To be added later.]

Command usage is also illustrated in the following sample scripts:

43_HttpTest.lua


Command History

Command was introduced in v. 3.4.2.

AltStyle によって変換されたページ (->オリジナル) /