Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » SciTE - Open Source Text Editor for Windows & Linux

Модерирует : gyra, Maz

Widok (23-11-2010 11:23): Лимит страниц. Продолжаем здесь  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

TymurGubayev

Junior Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
socket.bind (address, port [, backlog]) \nThis function is a shortcut that creates and returns a TCP server object bound to a local address and port, ready to accept client connections. Optionally, user can also specify the backlog argument to the listen method (defaults to 32).\n\n Note: The server object returned will have the option "reuseaddr" set to true.
socket.connect (address, port [, locaddr, locport]) \nThis function is a shortcut that creates and returns a TCP client object connected to a remote host at a given port. Optionally, the user can also specify the local address and port to bind (locaddr and locport).
socket.newtry (finalizer) socket.newtry(finalizer)\nCreates and returns a clean try function that allows for cleanup before the exception is raised.\nFinalizer is a function that will be called before try throws the exception. It will be called in protected mode.\nThe function returns your customized try function.  
socket.protect (func)\n Converts a function that throws exceptions into a safe function. This function only catches exceptions thrown by the try and newtry functions. It does not catch normal Lua errors.\nFunc is a function that calls try (or assert, or error) to throw exceptions.\nReturns an equivalent function that instead of throwing exceptions, returns nil followed by an error message.\n\nNote: Beware that if your function performs some illegal operation that raises an error, the protected function will catch the error and return it as a string. This is because the try function uses errors as the mechanism to throw exceptions.  
socket.select (recvt, sendt [, timeout])\n Waits for a number of sockets to change status.\n\n Recvt is an array with the sockets to test for characters available for reading. Sockets in the sendt array are watched to see if it is OK to immediately write on them. Timeout is the maximum amount of time (in seconds) to wait for a change in status. A nil, negative or omitted timeout value allows the function to block indefinitely. Recvt and sendt can also be empty tables or nil. Non-socket values (or values with non-numeric indices) in the arrays will be silently ignored.\n\n The function returns a list with the sockets ready for reading, a list with the sockets ready for writing and an error message. The error message is "timeout" if a timeout condition was met and nil otherwise. The returned tables are doubly keyed both by integers and also by the sockets themselves, to simplify the test if a specific socket has changed status.\n\n Important note: a known bug in WinSock causes select to fail on non-blocking TCP sockets. The function may return a socket as writable even though the socket is not ready for sending.\n\n Another important note: calling select with a server socket in the receive parameter before a call to accept does not guarantee accept will return immediately. Use the settimeout method or accept might block forever.\n\nYet another note: If you close a socket and pass it to select, it will be ignored.
socket.sink (mode, socket)\n Creates an LTN12 sink from a stream socket object.\n\n Mode defines the behavior of the sink. The following options are available:\n    - "http-chunked": sends data through socket after applying the chunked transfer coding, closing the socket when done;\n    - "close-when-done": sends all received data through the socket, closing the socket when done;\n    - "keep-open": sends all received data through the socket, leaving it open when done.\nSocket is the stream socket object used to send the data.\n\nThe function returns a sink with the appropriate behavior.
#~ socket.skip(d [, ret1, ret2 ... retN])\n is equal to select function from Lua5, so deprecated
socket.sleep (time)\n Freezes the program execution during a given amount of time.\n Time is the number of seconds to sleep for.
socket.source (mode, socket [, length])\n Creates an LTN12 source from a stream socket object.\n\n Mode defines the behavior of the source. The following options are available:\n    - "http-chunked": receives data from socket and removes the chunked transfer coding before returning the data;\n    - "by-length": receives a fixed number of bytes from the socket. This mode requires the extra argument length;\n    - "until-closed": receives data from a socket until the other side closes the connection.\n Socket is the stream socket object used to receive the data.\n\n The function returns a source with the appropriate behavior.
#~ socket.gettime () is like os.time function from Lua5, so deprecated
socket.try (ret1 [, ret2 ... retN])\n Throws an exception in case of error. The exception can only be caught by the protect function. It does not explode into an error message.\n Ret1 to retN can be arbitrary arguments, but are usually the return values of a function call nested with try.\n The function returns ret1 to retN if ret1 is not nil. Otherwise, it calls error passing ret2.  
socket._DEBUG \n This constant is set to true if the library was compiled with debug support.
socket._VERSION \nThis constant has a string describing the current LuaSocket version.
socket.__unload() unloads the library.
socket.tcp() = master object\nCreates and returns a TCP master object. A master object can be transformed into a server object with the method listen (after a call to bind) or into a client object with the method connect. The only other method supported by a master object is the close method.\nIn case of success, a new master object is returned. In case of error, nil is returned, followed by an error message.
master:bind (address, port)\nBinds a master object to address and port on the local host.\nAddress can be an IP address or a host name. Port must be an integer number in the range [0..64K). If address is '*', the system binds to all local interfaces using the INADDR_ANY constant. If port is 0, the system automatically chooses an ephemeral port.\nIn case of success, the method returns 1. In case of error, the method returns nil followed by an error message.\nNote: The function socket.bind is available and is a shortcut for the creation of server sockets.
master:connect (address, port)\nAttempts to connect a master object to a remote host, transforming it into a client object. Client objects support methods send, receive, getsockname, getpeername, settimeout, and close.\nAddress can be an IP address or a host name. Port must be an integer number in the range [1..64K).\nIn case of error, the method returns nil followed by a string describing the error. In case of success, the method returns 1.\nNote: The function socket.connect is available and is a shortcut for the creation of client sockets.\nNote: Starting with LuaSocket 2.0, the settimeout method affects the behavior of connect, causing it to return with an error in case of a timeout. If that happens, you can still call socket.select with the socket in the sendt table. The socket will be writable when the connection is established.
master:close()\n Closes a TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
master:getsockname()\nReturns the local address information associated to the object.\nThe method returns a string with local IP address and a number with the port. In case of error, the method returns nil.
master:getstats()\nReturns accounting information on the socket, useful for throttling of bandwidth.\nThe method returns the number of bytes received, the number of bytes sent, and the age of the socket object in seconds.
master:listen(backlog)\nSpecifies the socket is willing to receive connections, transforming the object into a server object. Server objects support the accept, getsockname, setoption, settimeout, and close methods.\nThe parameter backlog specifies the number of client connections that can be queued waiting for service. If the queue is full and another client attempts connection, the connection is refused.\nIn case of success, the method returns 1. In case of error, the method returns nil followed by an error message.
master:setstats(received, sent, age)\nResets accounting information on the socket, useful for throttling of bandwidth.\nReceived is a number with the new number of bytes received. Sent is a number with the new number of bytes sent. Age is the new age in seconds.\nThe method returns 1 in case of success and nil otherwise.
master:settimeout(value [, mode])\nChanges the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods send, receive, and accept will block indefinitely, until the operation completes. The settimeout method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.\nThe amount of time to wait is specified as the value parameter, in seconds. There are two timeout modes and both can be used together for fine tuning:\n    - 'b': block timeout. Specifies the upper limit on the amount of time LuaSocket can be blocked by the operating system while waiting for completion of any single I/O operation. This is the default mode;\n    - 't': total timeout. Specifies the upper limit on the amount of time LuaSocket can block a Lua script before returning from a call.\nThe nil timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
server:accept()\nWaits for a remote connection on the server object and returns a client object representing that connection.\nIf a connection is successfully initiated, a client object is returned. If a timeout condition is met, the method returns nil followed by the error string 'timeout'. Other errors are reported by nil followed by a message describing the error.\nNote: calling socket.select with a server object in the recvt parameter before a call to accept does not guarantee accept will return immediately. Use the settimeout method or accept might block until another client shows up.
server:close()\n Closes a TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
server:getsockname()\nReturns the local address information associated to the object.\nThe method returns a string with local IP address and a number with the port. In case of error, the method returns nil.
server:getstats()\nReturns accounting information on the socket, useful for throttling of bandwidth.\nThe method returns the number of bytes received, the number of bytes sent, and the age of the socket object in seconds.
server:setoption(option [, value])\nSets options for the TCP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.\nOption is a string with the option name, and value depends on the option being set:\n    - 'keepalive': Setting this option to true enables the periodic transmission of messages on a connected socket. Should the connected party fail to respond to these messages, the connection is considered broken and processes using the socket are notified;\n    - 'linger': Controls the action taken when unsent data are queued on a socket and a close is performed. The value is a table with a boolean entry 'on' and a numeric entry for the time interval 'timeout' in seconds. If the 'on' field is set to true, the system will block the process on the close attempt until it is able to transmit the data or until 'timeout' has passed. If 'on' is false and a close is issued, the system will process the close in a manner that allows the process to continue as quickly as possible. I do not advise you to set this to anything other than zero;\n    - 'reuseaddr': Setting this option indicates that the rules used in validating addresses supplied in a call to bind should allow reuse of local addresses;\n    - 'tcp-nodelay': Setting this option to true disables the Nagle's algorithm for the connection.\n The method returns 1 in case of success, or nil otherwise.\n\nNote: The descriptions above come from the man pages.
server:setstats(received, sent, age)\nResets accounting information on the socket, useful for throttling of bandwidth.\nReceived is a number with the new number of bytes received. Sent is a number with the new number of bytes sent. Age is the new age in seconds.\nThe method returns 1 in case of success and nil otherwise.
server:settimeout(value [, mode])\nChanges the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods send, receive, and accept will block indefinitely, until the operation completes. The settimeout method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.\nThe amount of time to wait is specified as the value parameter, in seconds. There are two timeout modes and both can be used together for fine tuning:\n    - 'b': block timeout. Specifies the upper limit on the amount of time LuaSocket can be blocked by the operating system while waiting for completion of any single I/O operation. This is the default mode;\n    - 't': total timeout. Specifies the upper limit on the amount of time LuaSocket can block a Lua script before returning from a call.\nThe nil timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
client:close()\n Closes a TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
client:getpeername()\nReturns information about the remote side of a connected client object.\nReturns a string with the IP address of the peer, followed by the port number that peer is using for the connection. In case of error, the method returns nil.
client:getsockname()\nReturns the local address information associated to the object.\nThe method returns a string with local IP address and a number with the port. In case of error, the method returns nil.
client:getstats()\nReturns accounting information on the socket, useful for throttling of bandwidth.\nThe method returns the number of bytes received, the number of bytes sent, and the age of the socket object in seconds.
client:receive([pattern [, prefix]])\nReads data from a client object, according to the specified read pattern. Patterns follow the Lua file I/O format, and the difference in performance between all patterns is negligible.\nPattern can be any of the following:\n    - '*a': reads from the socket until the connection is closed. No end-of-line translation is performed;\n    - '*l': reads a line of text from the socket. The line is terminated by a LF character (ASCII 10), optionally preceded by a CR character (ASCII 13). The CR and LF characters are not included in the returned line. In fact, all CR characters are ignored by the pattern. This is the default pattern;\n    - number: causes the method to read a specified number of bytes from the socket.\n Prefix is an optional string to be concatenated to the beginning of any received data before return.\n If successful, the method returns the received pattern. In case of error, the method returns nil followed by an error message which can be the string 'closed' in case the connection was closed before the transmission was completed or the string 'timeout' in case there was a timeout during the operation. Also, after the error message, the function returns the partial result of the transmission.\n Important note: This function was changed severely. It used to support multiple patterns (but I have never seen this feature used) and now it doesn't anymore. Partial results used to be returned in the same way as successful results. This last feature violated the idea that all functions should return nil on error. Thus it was changed too.
client:send(data [, i [, j]])\nSends data through client object.\nData is the string to be sent. The optional arguments i and j work exactly like the standard string.sub Lua function to allow the selection of a substring to be sent.\nIf successful, the method returns the index of the last byte within [i, j] that has been sent. Notice that, if i is 1 or absent, this is effectively the total number of bytes sent. In case of error, the method returns nil, followed by an error message, followed by the index of the last byte within [i, j] that has been sent. You might want to try again from the byte following that. The error message can be 'closed' in case the connection was closed before the transmission was completed or the string 'timeout' in case there was a timeout during the operation.\nNote: Output is not buffered. For small strings, it is always better to concatenate them in Lua (with the '..' operator) and send the result in one call instead of calling the method several times.
client:setoption(option [, value])\nSets options for the TCP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.\nOption is a string with the option name, and value depends on the option being set:\n    - 'keepalive': Setting this option to true enables the periodic transmission of messages on a connected socket. Should the connected party fail to respond to these messages, the connection is considered broken and processes using the socket are notified;\n    - 'linger': Controls the action taken when unsent data are queued on a socket and a close is performed. The value is a table with a boolean entry 'on' and a numeric entry for the time interval 'timeout' in seconds. If the 'on' field is set to true, the system will block the process on the close attempt until it is able to transmit the data or until 'timeout' has passed. If 'on' is false and a close is issued, the system will process the close in a manner that allows the process to continue as quickly as possible. I do not advise you to set this to anything other than zero;\n    - 'reuseaddr': Setting this option indicates that the rules used in validating addresses supplied in a call to bind should allow reuse of local addresses;\n    - 'tcp-nodelay': Setting this option to true disables the Nagle's algorithm for the connection.\n The method returns 1 in case of success, or nil otherwise.\n\nNote: The descriptions above come from the man pages.
client:setstats(received, sent, age)\nResets accounting information on the socket, useful for throttling of bandwidth.\nReceived is a number with the new number of bytes received. Sent is a number with the new number of bytes sent. Age is the new age in seconds.\nThe method returns 1 in case of success and nil otherwise.
client:settimeout(value [, mode])\nChanges the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods send, receive, and accept will block indefinitely, until the operation completes. The settimeout method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.\nThe amount of time to wait is specified as the value parameter, in seconds. There are two timeout modes and both can be used together for fine tuning:\n    - 'b': block timeout. Specifies the upper limit on the amount of time LuaSocket can be blocked by the operating system while waiting for completion of any single I/O operation. This is the default mode;\n    - 't': total timeout. Specifies the upper limit on the amount of time LuaSocket can block a Lua script before returning from a call.\nThe nil timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
client:shutdown(mode)\nShuts down part of a full-duplex connection.\nMode tells which way of the connection should be shut down and can take the value:\n    - "both": disallow further sends and receives on the object. This is the default mode;\n    - "send": disallow further sends on the object;\n    - "receive": disallow further receives on the object.\nThis function returns 1.
socket.dns
socket.dns.gethostname() = string\nReturns the standard host name for the machine as a string.
socket.dns.tohostname(address) = string\n Converts from IP address to host name.\nAddress can be an IP address or host name.\nThe function returns a string with the canonic host name of the given address, followed by a table with all information returned by the resolver. In case of error, the function returns nil followed by an error message.
socket.dns.toip(address) = string\nConverts from host name to IP address.\nAddress can be an IP address or host name.\nReturns a string with the first IP address found for address, followed by a table with all information returned by the resolver. In case of error, the function returns nil followed by an error message.
socket.sinkt.default() == sinkt["keep-open"]()\n see source
socket.sinkt["close-when-done"] ()\n see source
socket.sinkt["keep-open"] ()\n see source
socket.sourcet.default() == sourcet.until-closed()\n see source
socket.sourcet["until-closed"]()\n see source
socket.sourcet["by-length"]()\n see source
ltn12
ltn12.filter
ltn12.pump
ltn12.sink
ltn12.source
ltn12.filter.chain(filter1, filter2 [, ... filterN])\nReturns a filter that passes all data it receives through each of a series of given filters.\nFilter1 to filterN are simple filters.\nThe function returns the chained filter.
ltn12.filter.cycle(low [, ctx, extra])\nReturns a high-level filter that cycles though a low-level filter by passing it each chunk and updating a context between calls.\nLow is the low-level filter to be cycled, ctx is the initial context and extra is any extra argument the low-level filter might take.\nThe function returns the high-level filter.
ltn12.pump.all(source, sink)\nPumps all data from a source to a sink.\nIf successful, the function returns a value that evaluates to true. In case of error, the function returns a false value, followed by an error message.
ltn12.pump.step(source, sink)\nPumps one chunk of data from a source to a sink.\nIf successful, the function returns a value that evaluates to true. In case of error, the function returns a false value, followed by an error message.
ltn12.sink.chain(filter, sink)\nCreates and returns a new sink that passes data through a filter before sending it to a given sink.
ltn12.sink.error(message)\nCreates and returns a sink that aborts transmission with the error message.
ltn12.sink.file(handle, message)\nCreates a sink that sends data to a file.\nHandle is a file handle. If handle is nil, message should give the reason for failure.\nThe function returns a sink that sends all data to the given handle and closes the file when done, or a sink that aborts the transmission with the error message.
ltn12.sink.null()\nReturns a sink that ignores all data it receives.
ltn12.sink.simplify(sink)\nCreates and returns a simple sink given a fancy sink.
ltn12.sink.table([table])\nCreates a sink that stores all chunks in a table. The chunks can later be efficiently concatenated into a single string.\nTable is used to hold the chunks. If nil, the function creates its own table.\nThe function returns the sink and the table used to store the chunks.
ltn12.source.cat(source1 [, source2, ..., sourceN])\nCreates a new source that produces the concatenation of the data produced by a number of sources.\nSource1 to sourceN are the original sources.\nThe function returns the new source.
ltn12.source.chain(source, filter)\nCreates a new source that passes data through a filter before returning it.\nThe function returns the new source.
ltn12.source.empty()\nCreates and returns an empty source.
ltn12.source.error(message)\nCreates and returns a source that aborts transmission with the error message.
ltn12.source.file(handle, message)\nCreates a source that produces the contents of a file.\nHandle is a file handle. If handle is nil, message should give the reason for failure.\nThe function returns a source that reads chunks of data from given handle and returns it to the user, closing the file when done, or a source that aborts the transmission with the error message.
ltn12.source.simplify(source)\nCreates and returns a simple source given a fancy source.
ltn12.source.string(string)\nCreates and returns a source that produces the contents of a string, chunk by chunk.

Всего записей: 35 | Зарегистр. 24-11-2008 | Отправлено: 17:53 27-11-2008 | Исправлено: TymurGubayev, 18:44 27-11-2008
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » SciTE - Open Source Text Editor for Windows & Linux
Widok (23-11-2010 11:23): Лимит страниц. Продолжаем здесь


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru