Error getting tags :
error 404Error getting tags :
error 404 accept | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Expander triangle

accept [datagram] connections on port number with message callbackMessage

Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Accepts an internet connection and creates a socket for that connection.

accept connections on port 80 with message "webConnect"
accept datagram connections on port it with message myMessage

Additional Comments
Expander triangle

Use the accept command when running a server, to accept TCP connections or UDP datagrams from other systems (or other processes on the same system).

Use the datagram option if you want to accept UDP datagrams.


The portNumber is the TCP port number on which to accept connections.

The callbackMessage is the name of a message to be sent when a connection is made or a datagram is received.


When a connection is made or a datagram is received, the accept command creates a new socket that can be used to communicate with the other system (or process). When using the close socket, read from socket, or write to socket commands, you can refer to this socket with a socket identifier that looks like this:


where the connectionID is a number assigned by the accept command. (You only need to specify the connection number if there is more than one socket connected to a particular port and host.)

The callbackMessage is sent to the object whose script contains the accept command. Either one or two parameters are sent with this message. The first parameter is the IP address of the system or process making the connection. If a datagram is being accepted, the second parameter is the contents of the datagram.

For technical information about sockets, see RFC 147 at <>.

For technical information about UDP datagrams, see RFC 768 at <>.

For technical information about the numbers used to designate standard ports, see the list of port numbers at <>, in particular the section entitled "Well Known Port Numbers".

User Comments
Expander triangle
User thumbnail
Apr 26, 2009
Actually, the callbackMessage gets a full socket specifier as its first argument - not just the IP address of the connecting peer