XTerm
所属分类:Telnet客户端/Shell
开发工具:Python
文件大小:10005KB
下载次数:0
上传日期:2019-11-04 07:05:27
上 传 者:
sh-1993
说明: Chat服务器
(ChatServer)
文件列表:
.ini (26, 2019-11-04)
RemoteDrive (0, 2019-11-04)
RemoteDrive\GDrive.py (13199, 2019-11-04)
RemoteDrive\client_secrets.json (430, 2019-11-04)
describe (0, 2019-11-04)
describe\describe.exe (10785590, 2019-11-04)
lure.exe (2571482, 2019-11-04)
migrate (0, 2019-11-04)
migrate\migrate.py (1906, 2019-11-04)
nhu.exe (6829819, 2019-11-04)
setting.json (283, 2019-11-04)
shark (0, 2019-11-04)
shark\HNhu.py (1034, 2019-11-04)
shark\MsgComm.py (1272, 2019-11-04)
shark\jsonplay.py (1464, 2019-11-04)
shark\shark.py (363, 2019-11-04)
xterm.exe (5247756, 2019-11-04)
# Overview:
A simple ChatServer (yet a panel) for sending and recieving JSON messages between clients
For full access, python 3.x is required
# How to use ?
In order to take advantage of the server,
First, start XTerm.exe (or start an x86 for 32 bit machine). Next, from any programming language (requires socket library supported):
```
socket = new Socket ('localhost', 1***72) // default XTerm port is 1***72
// from now on we can send and recieve via the socket
// but watch out
// A message is consisting of 2 parts: first 4 bytes are for message size (in byte, denote n) and next n bytes represent the message content in json format
socket.close ()
```
we can accomplish these tasks:
1. Query some information of kernel:
You should sent a Message (format shown below) comprising of:
```c++
{
"type" : "request"
"function" : "kernel",
"request" : "get"
"variable" : "
"
}
```
Response will have a form like:
```
{
"type": "response"
"success" : "true" // or "success":"false"
"result": ""
}
```
2. Create a channel, from now on the connection (socket) is used for publishing, see MQTT for more information:
```
{
"type" : "request"
"function" : "kernel",
"request" : "create"
"channel" : ""
}
```
After the sending attempt, socket should recieve a message contain
```
{
"type":"response"
"result":"",
"success":"true"
}
```
otherwise a message
```
{
"type":"response"
"success": "false"
"result":""
}
```
is returned
3. Subscribe a channel:
```
{
"type":"response"
"type" : "request"
"function" : "kernel",
"request" : "subscribe"
"channel" : ""
}
```
if succeed, the kernel-XTerm- should return a json message:
```
{
"type":"response"
"success":"true",
"channel":""
}
```
else a message which formed
```
{
"type":"response"
"success":"false",
"result":"error_description"
}
is returned
```
From the time of successful subscription, the socket will be recieving messages having structure like this:
```
{
"type":"noftify",
"channel":"subscribed channel"
...
}
```
4. Accepted function via socket:
近期下载者:
相关文件:
收藏者: