Python 提供了两个基本的 socket 模块:
Socket它提供了标准的BSD Socket API。SocketServer它提供了服务器重心,可以简化网络服务器的开发。
下面讲解下 Socket模块功能。
| // Author: SNWCreations (GitHub: @SNWCreations) | |
| // Licensed under CC0 License, feel free to use this anywhere. | |
| /** | |
| * Find the player pawn which is actually controlled by the given player. | |
| * This will consider bots which are controlled by players. | |
| */ | |
| public static CCSPlayerPawn? FindActualPawn(CCSPlayerController player) | |
| { | |
| // Better solution after some research: |
| /* | |
| * capturing from UVC cam | |
| * requires: libjpeg-dev | |
| * build: gcc -std=c99 capture.c -ljpeg -o capture | |
| */ | |
| #include <stdint.h> | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <string.h> |
| # coding: UTF-8 | |
| import sys | |
| from PySide import QtGui, QtCore | |
| u""" サンプルデータ """ | |
| title = ["hoge", "fuga", "piyo"] | |
| data = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] |
| /* | |
| * V4L2 video capture example | |
| * | |
| * This program can be used and distributed without restrictions. | |
| * | |
| * This program is provided with the V4L2 API | |
| * see http://linuxtv.org/docs.php for more information | |
| */ | |
| #include <stdio.h> |