资源简介
便携版。非安装版。
32位Windows版Git便携版PortableGit-2.11.0-32-bit.7z.exe
代码片段和文件信息
#!/usr/bin/python
#
# Server that will accept connections from a Vim channel.
# Run this server and then in Vim you can open the channel:
# :let handle = ch_open(‘localhost:8765‘)
#
# Then Vim can send requests to the server:
# :let response = ch_sendexpr(handle ‘hello!‘)
#
# And you can control Vim by typing a JSON message here e.g.:
# [“ex““echo ‘hi there‘“]
#
# There is no prompt just type a line and press Enter.
# To exit cleanly type “quit“.
#
# See “:help channel-demo“ in Vim.
#
# This requires Python 2.6 or later.
from __future__ import print_function
import json
import socket
import sys
import threading
try:
# Python 3
import socketserver
except ImportError:
# Python 2
import SocketServer as socketserver
thesocket = None
class ThreadedTCPRequestHandler(socketserver.baseRequestHandler):
def handle(self):
print(“=== socket opened ===“)
global thesocket
thesocket = self.request
while True:
try:
data = self.request.recv(4096).decode(‘utf-8‘)
except socket.error:
print(“=== socket error ===“)
break
except IOError:
print(“=== socket closed ===“)
break
if data == ‘‘:
print(“=== socket closed ===“)
break
print(“received: {0}“.format(data))
try:
decoded = json.loads(data)
except ValueError:
print(“json decoding failed“)
decoded = [-1 ‘‘]
# Send a response if the sequence number is positive.
# Negative numbers are used for “eval“ responses.
if decoded[0] >= 0:
if decoded[1] == ‘hello!‘:
response = “got it“
else:
response = “what?“
encoded = json.dumps([decoded[0] response])
print(“sending {0}“.format(encoded))
self.request.sendall(encoded.encode(‘utf-8‘))
thesocket = None
class ThreadedTCPServer(socketserver.ThreadingMixIn socketserver.TCPServer):
pass
if __name__ == “__main__“:
HOST PORT = “localhost“ 8765
server = ThreadedTCPServer((HOST PORT) ThreadedTCPRequestHandler)
ip port = server.server_address
# Start a thread with the server -- that thread will then start one
# more thread for each request
server_thread = threading.Thread(target=server.serve_forever)
# Exit the server thread when the main thread terminates
server_thread.daemon = True
server_thread.start()
print(“Server loop running in thread: “ server_thread.name)
print(“Listening on port {0}“.format(PORT))
while True:
typed = sys.stdin.readline()
if “quit“ in typed:
print(“Goodbye!“)
break
if thesocket is None:
print(“No socket yet“)
else:
print(“sending {0}“.format(type
相关资源
- Conceptual Wavelets in Digital Signal Processi
- Windows Installer 4.5 vs2015项目打包文件全
- glog及gflags在Windows下的预编译库
- WINDOWS 英文字体 900英文字库
- Redis的Windows版本内含3.2.100和4.0.2.2两个
- 《Windows设备驱动程序WDF开发》源码
- Hands-On Mircrosoft Windows Server 2016
- NM34 windows 无线抓包
- 4个抓取论文里的图表曲线软件(dig
- pandoc-1.17.1-1-windows.msi
- Tower 2.3.2 git GUI for Mac 破解版
- GitHub入门与实践.pdf
- Windows.7设备驱动程序开发.pdf
- 好用的编程字体,中英合成
- Windows核心编程PDF完整版
- depthmapX-0.50-64bit-Windows
- windows核心编程pdf高清版
- 数字通信第五版英文版Digital Communic
- 懒人工具v4.5864位,Windows快捷方式集合
- Rapid Prototyping of Digital Systems
- VMD 1.9.3 beta 1 windows 32位
- Node 最新 Windows 64 位版本node-v8.1.2-x6
- windows下的Xamarin破解补丁+破解方法
- ffmpeg+SDL2实现的视频播放器(windows版
- CMake 3.6.2 Windows 32位 官方安装版
- CMake 3.6.2 Windows 64位 官方安装版
- TortoiseGit-2.6.0.0-64位附加汉化包
- redis desktop manager for windows 0.9.9
- asterisk for windows
- jre-6u16-windows-i586.exe
评论
共有 条评论