talk is very convoluted in that it uses UDP to negotiate the connections between the two sites and then uses TCP to actually move the data back and forth between the participants. UDP is used between the calling client and the answering server, and again between the answering client and the calling server; TCP is then used between the two clients.
To further complicate matters, there are two incompatible versions of the talk protocol, commonly referred to as either talk and ntalk (for "new talk") or otalk (for "old talk") and talk, depending on who you ask. The earlier version depended on bytes being in a certain order in memory and only worked reliably between machines of the same CPU type. The later version fixes this problem but is incompatible with the earlier version.
The calling client contacts the answering server via UDP to announce the call. The answering server tells the user being called that someone is requesting a talk session and how the user should respond in order to accept the call. While waiting for the user to respond, the calling client also contacts the calling server to say that it's expecting an incoming call and to specify what TCP port it wishes to use for that call (somewhat like calling your secretary to say that you're expecting a call back from someone and that it should be put through to the extension you're currently at). When the answering user accepts, that user's client (the answering client) contacts the calling server via UDP to find out what port the calling client is waiting on; the answering client then contacts the calling client on that TCP port. Figure 19-2 shows how talk works.
Direction | SourceAddr. | Dest.Addr. | Protocol | SourcePort | Dest.Port | ACKSet | Notes |
---|---|---|---|---|---|---|---|
In | Ext | Int | UDP | >1023 |
517 518[101]
|
[102]
|
External client contacting internal server |
Out | Int | Ext | UDP |
517 518[101] |
>1023 | [102] | Internal server answering external client |
Out | Int | Ext | UDP | >1023 |
517 518[101] |
[102] | Internal client contacting external server |
In | Ext | Int | UDP |
517 518[101] |
>1023 | [102] | External server answering internal client |
Out | Int | Ext | TCP | >1023 | >1023 |
[103]
|
Internal client communicating with external client |
In | Ext | Int | TCP | >1023 | >1023 | [103] | External client communicating with internal client |
[101]Old versions of talk use port 517; newer versions use port 518.
[102]UDP has no ACK equivalent.
[103]ACK is not set on the first packet of this type (establishing connection) but will be set on the rest.