Home Contents | # mtd16.attach | Mtd16io | Core4 Lua Event System

## SYNOPSIS

msghandle = mtd16.attach(app, fd[, fdwr])

## DESCRIPTION

Attach a new message handler to a file descriptor. The handler is attached to the event processor passed in app and exchanges messages on the open file descriptor fd.

Often, fd is an open TCP/IP network connection.

Optionally, a second file descriptor fdwr can be given. In that case, the first file descriptor is used for reading only, while the second is used for writing.

## RETURN VALUE

Returns a message handler instance.

## NOTES

This handler exchanges raw MTD16 message without any error recovery. Do not use on plain serial ports, but only with transport protocols that have their own reliable means of transport, like TCP/IP.

## SEE ALSO

mtd16io:close, mtd16io.event, mtd16io.eof