# TCPX Opcodes > [HTML Version](tcpxopcodes.htm) This table contains a brief explanation of the operation of each opcode. Note that in nearly all cases, you will need to check the return value of the [Status](status(tcpx).htm.md) parameter to determine the outcome of the operation. | | | | |------|------|------| | **Symbol** | **Value** | **Operation** | | TCPOP\_ACCEPT | 1 | Create listening socket on port specified by _sockport_, and wait for a client to connect. Be careful to make sure that the _buffer_ parameter is empty, or else the first 32 bytes of it will be sent, unsolicited, to the client immediately after accepting the connection, which is likely to cause confusion unless the client was specifically expecting it.) On successful return, _sockport_ is set to the connected socket, and must be specified to all the other calls for this socket. | | TCPOP\_WRITE | 2 | Write _buffer_ to socket. | | TCPOP\_READ | 4 | Read _buffer_ from socket. | | TCPOP\_SHUTDOWN | 5 | Informs the other end that we are shutting down prior to the close. This is mainly useful when shutting down only one direction. See _flags_. | | TCPOP\_CLOSE | 6 | Close socket. You must do this explicitly when done, since BASIC will not close sockets for you at the end of the program, like it does for files. Note that TCPX will automatically close the socket after certain errors, in which case it will set _sockport_ to -1. In other words, if _sockport_ = -1, don't bother to close it; doing so redundantly is harmless but will return you the error _status_ = -1. | | TCPOP\_CHECK | 7 | Check if data available to read; returns _status_=1 if so, 0 if not, and <0 if the socket has been closed at the other end. Also used with [Asynchronous Client Connections](asynchronousclientcon.htm.md) and [Advanced Server Connection Options](advancedserveroptions.htm.md) to check if the connection is complete or ready to accept. | | TCPOP\_CHKQTY | 8 | Check how much data avail to read; return number of bytes in _status_, <0 indicates socket closed or dropped at other end. | | TCPOP\_CONNECT | 9 | (client) Connect to generic server. If _timer_ > 0 and the connection is not established within the specified time, the connection is aborted. See [Asynchronous Client Connections](asynchronousclientcon.htm.md). | | TCPOP\_CONNECT\_OLD | 10 | (client) Equivalent to old TCPCLI _opcode_ 1; now considered archaic | | TCPOP\_ERRMSG | 11 | Return system error message corresponding to _status_. | | TCPOP\_STARTTLS | 12 | TCPX opcode to initiate [STARTTLS](starttls.htm.md). | | TCPOP\_WRITE\_UDP | 18 | UDP version of WRITE. | | TCPOP\_READ\_UDP | 20 | UDP version of READ. |