# 12 `mactcp` -- The MacTCP interfaces

Availability: Macintosh.

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 built-in module `socket` is also available on the Macintosh it is usually easier to use sockets instead of the Macintosh-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.

Subsections

- 12.1 TCP Stream Objects
- 12.2 TCP Status Objects
- 12.3 UDP Stream Objects