Network Programming

The Wolfram Language includes built-in network programming, allowing uniform convenient access to both TCP and ZMQ socket functionality on all platforms, as well as a variety of functions for network connectivity and name resolution.

IPAddress symbolic representation of an IPv4 or IPv6 IP address

URL symbolic representation of a URL, potentially including a port number (default: 80)

SocketConnect start a connection to a socket

SocketListen set up handlers to be run whenever data arrives on a socket

SocketWaitNext  ▪  SocketWaitAll  ▪  SocketReadyQ

Close close the connection to a socket

Symbolic Representations

SocketObject symbolic representation of a connected socket

Sockets get a list of remote, local, etc. sockets

SocketListener  ▪  DeleteObject

Reading from Sockets

ReadString read as a string all data until a socket is closed

ReadByteArray read as a byte array all data until a socket is closed

BinaryRead, BinaryReadList read binary data from a socket

Read, ReadList read data in specified formats from a socket

SocketReadMessage read as a byte array a single message from a socket

Writing to Sockets

WriteString write a string to a socket

BinaryWrite write binary data to a socket

Write write data in a specified format to a socket

Format Conversion

ImportString  ▪  ExportString  ▪  ImportByteArray  ▪  ExportByteArray

ByteArrayToString  ▪  StringToByteArray  ▪  BaseEncode  ▪  BaseDecode

Server-Side Socket Setup

SocketOpen open a socket to accept connections

Utilities

HostLookup look up an IP address or host name (DNS and reverse DNS)

PingTime measure the ping time for a network host

TimeConstrained allow only a specified time for network connection

HTTPRequest  ▪  HTTPResponse  ▪  URLRead  ▪  URLSubmit  ▪  URLResponseTime

URLBuild  ▪  URLParse

Internet Data »

InternetDomain NetworkService TopLevelDomain ...

Low-Level Network Operations

NetworkPacketCapture capture information on all network packets

NetworkPacketRecording  ▪  $NetworkInterfaces  ▪  $DefaultNetworkInterface

NetworkPacketTrace record packets during the evaluation of an expression

$NetworkConnected whether the network interface on your computer is active

$AllowInternet  ▪  $DefaultProxyRules  ▪  $MachineDomains  ▪  $MachineAddresses  ▪  "PCAP"

Pub-Sub Channel Communisation »

CreateChannel  ▪  ChannelSend  ▪  ChannelListen  ▪  ...