The IB tws socket api works over a TCP/IP socket, so that bytes are delivered reliably and in order as long as the socket is working. Since, however, the tws is threaded, and talks to multiple upstream servers, the messages delivered over TCP are themselves delivered non-deterministically, that is with uncertain order.
Note that here as with other aspects of the IB tws api, there is no formal specification, and the IB tws does not itself have freely available sources, so that all of this section must necessarily be tentative. Note also that the IB tws api is currently under active development, so that the material here is very much subject to change, whether by the replacement of existing events with new versions, or the addition of new request and message types entirely.
The rest of this section will focus on: the interpretation of bytes read from the TCP socket, § 6.1.1; common features of the IB tws binary protocols, § 6.1.2; the initial handshake, § 6.1.3; api requests to the tws, § ; and api messages from the tws, § .