# 15.11 Built-in Module `mactcp`

This module provides an interface to the Macintosh TCP/IP driver MacTCP. There is an accompanying module `macdnr` which provides an interface to the name-server (allowing you to translate hostnames to ip-addresses), a module `MACTCPconst` which has symbolic names for constants constants used by MacTCP. Since the builtin module `socket` is also available on the mac it is usually easier to use sockets in stead of the mac-specific MacTCP API.

A complete description of the MacTCP interface can be found in the Apple MacTCP API documentation.

`MTU` ()
  Return the Maximum Transmit Unit (the packet size) of the network interface.

`IPAddr` ()
  Return the 32-bit integer IP address of the network interface.

`NetMask` ()
  Return the 32-bit integer network mask of the interface.

`TCPCreate` (size)
  Create a TCP Stream object. size is the size of the receive buffer, `4096` is suggested by various sources.

`UDPCreate` (size, port)
  Create a UDP stream object. size is the size of the receive buffer (and, hence, the size of the biggest datagram you can receive on this port). port is the UDP port number you want to receive datagrams on, a value of zero will make MacTCP select a free port.

- 15.11.1 TCP Stream Objects
- 15.11.2 TCP Status Objects
- 15.11.3 UDP Stream Objects