⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 261.htm

📁 unix高级编程原吗
💻 HTM
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>CTerm非常精华下载</title>
</head>
<body bgcolor="#FFFFFF">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="577">
<tr><td width="32%" rowspan="3" height="123"><img src="DDl_back.jpg" width="300" height="129" alt="DDl_back.jpg"></td><td width="30%" background="DDl_back2.jpg" height="35"><p align="center"><a href="http://apue.dhs.org"><font face="黑体"><big><big>apue</big></big></font></a></td></tr>
<tr>
<td width="68%" background="DDl_back2.jpg" height="44"><big><big><font face="黑体"><p align="center">               ● UNIX网络编程                       (BM: clown)                </font></big></big></td></tr>
<tr>
<td width="68%" height="44" bgcolor="#000000"><font face="黑体"><big><big><p   align="center"></big></big><a href="http://cterm.163.net"><img src="banner.gif" width="400" height="60" alt="banner.gif"border="0"></a></font></td>
</tr>
<tr><td width="100%" colspan="2" height="100" align="center" valign="top"><br><p align="center">[<a href="index.htm">回到开始</a>][<a href="247.htm">上一层</a>][<a href="262.htm">下一篇</a>]
<hr><p align="left"><small>发信人: nothing (迷茫~浮), 信区: Winsock <br>

标  题: icq protocol(7) <br>

发信站: 武汉白云黄鹤站 (Thu May 11 10:18:46 2000), 转信 <br>

  <br>

COMMUNICATION BETWEEN TWO CLIENTS USING TCP (Peer to peer mode) <br>

=============================================================== <br>

When a user wishes to send a message, an URL etc, to another user (called <br>

the "remote" user as opposite to the "local" user), the local user first <br>

checks to see if a TCP connection already is established to that user. If <br>

so is the case, then that connection will be used. If not, the user checks <br>

the remote users IP address and port number (information sent to the user <br>

from the server when the remote user logged in), and makes a connection to <br>

that address. Typical port numbers are in the range 1200-1300 (decimal). <br>

When a new connection is formed, a CHANNEL_INIT message must be sent. From <br>

there on, however, every time the user wishes to send a message, a <br>

CHANNEL_MESSAGE is sent. All messages sent must be acknowledged by the other <br>

side, using CHANNEL_ACK. Furthermore, all messages is replied to by another <br>

message from the receiver - which most often is empty, unless the user has <br>

posted a Away/DND message, in case this will be sent as a reply. <br>

The TCP communication is similar to the UDP communication, in that all <br>

communication is done trough separate packets (often, but now always <br>

associated with individual TCP packets). Each packet must contain the <br>

packet's length (excluding the length count) as the first two bytes. Most <br>



messages contains the senders UIN as the next field. <br>

CHANNEL_INIT Initiate inter-user communication using TCP <br>

------------ <br>

Parameters: <br>

Length Content (if fixed) Name Description <br>

------ ------------------ ---- ----------- <br>

2 bytes 1A 00 LENGTH Length of this packet <br>

1 byte FF INIT_IDENT Identifies this packet as an i <br>

nitiation <br>

4 bytes 02 00 00 00 X1 *Unknown <br>

4 bytes 00 00 00 00 X2 *Unknown <br>

4 bytes xx xx xx xx MY_UIN The local user's UIN <br>

4 bytes xx xx xx xx MY_IP The user's IP address <br>

4 bytes xx xx xx xx MY_IP_REAL The user's actual IP address <br>

1 byte 04 X3 *Unknown <br>

4 bytes xx xx xx xx MY_PORT The user's TCP port for incomi <br>

ng messages <br>

Note that the port used for the "outgoing" connection is different from <br>

MY_PORT, the port other clients use to connect to this client. For the <br>

difference between MY_IP and MY_IP_REAL, see USER_ONLINE. <br>

CHANNEL_MESSAGE Send message to online user <br>

------------ <br>

------------ <br>

Parameters: <br>

Length Content (if fixed) Name Description <br>

------ ------------------ ---- ----------- <br>

2 bytes xx xx LENGTH Length of this packet <br>

4 bytes xx xx xx xx UIN The local user's UIN <br>

2 bytes 02 00 VERSION Identifies this as a ICQ packe <br>

t <br>

2 bytes EE 07 MSG_COMMAND The message type for CHANNEL_M <br>

ESSAGE <br>

2 bytes 00 00 X1 *Unknown <br>

4 bytes xx xx xx xx UIN_2 The local user's UIN <br>

2 bytes xx xx TYPE Message type <br>

2 bytes xx xx LENGTH Length of MESSAGE including NU <br>

LL <br>

variable MESSAGE The message to be sent, NULL t <br>

erminated <br>

4 bytes xx xx xx xx MY_IP_REAL The user's actual IP address <br>

4 bytes xx xx xx xx MY_IP The user's IP address <br>

4 bytes xx xx xx xx PORT The user's TCP port for incomi <br>

ng messages <br>

1 byte 04 X2 *Unknown <br>

2 bytes 00 00 X3 *Unknown <br>



2 bytes xx xx CMD_TYPE Identifies message as new mess <br>

age or reply <br>

4 bytes xx xx xx xx X4 *Unknown (checksum? sequence n <br>

umber?) <br>

The TYPE is the same as described in RECEIVE_MESSAGE. The difference between <br>

MY_IP and MY_IP_REAL is described in USER_ONLINE. The CMD_TYPE can have two <br>

possible values: <br>

10 00 = This is a new ('real', user initiated) message <br>

00 00 = This is an auto reply <br>

The auto reply is sent as an acknowledgement to all 'real' messages. They <br>

usually contains an empty message, but if the remote user is 'Away' or in <br>

DND mode, the reply will contain the Away/DND message. The X4 field is a <br>

bit tricky. It is always between 00 FF FF FF and FF FF FF FF, but the exact <br>

function of the field is unknown. <br>

  <br>

-- <br>

※ 来源:.武汉白云黄鹤站 bbs.whnet.edu.cn.[FROM: 202.120.9.13] <br>

</small><hr>
<p align="center">[<a href="index.htm">回到开始</a>][<a href="247.htm">上一层</a>][<a href="262.htm">下一篇</a>]
<p align="center"><a href="http://cterm.163.net">欢迎访问Cterm主页</a></p>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -