This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
# a simple tcp client | |
import socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect(('127.0.0.1', 12345)) | |
#sock.send('Test\n') | |
sock.send(raw_input("Please input : ")) | |
print sock.recv(1024) | |
sock.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
import socket,time,string,random,thread | |
m_Vars = { | |
"bufLen" : 1024 * 10, | |
"defaultServerIp" : "192.168.1.100", | |
"defaultServerPort" : 554, | |
"defaultTestUrl" : "rtsp://192.168.1.100/test1.mp4", | |
"defaultUserAgent" : "LibVLC/2.0.3 (LIVE555 Streaming Media v2011.12.23)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Implementation of a UDP proxy | |
package main | |
import ( | |
"flag" | |
"fmt" | |
"log" | |
"net" | |
"os" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
# a simple tcp server | |
import socket,os | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.bind(('127.0.0.1', 12345)) | |
sock.listen(5) | |
while True: | |
connection,address = sock.accept() | |
buf = connection.recv(1024) | |
print buf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
File : udpProxyServer.cpp | |
Author : Mike | |
E-Mail : Mike_Zhang@live.com | |
*/ | |
#include <cstdlib> | |
#include <cstddef> | |
#include <iostream> | |
#include <string> | |
#include <boost/shared_ptr.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("lsqlite3") | |
-- Igmar: Wanneer closen we dat DB object eigenlijk ? | |
db = sqlite3.open('/etc/asterisk/users.sqlite') | |
--CONSOLE = "Console/dsp" -- Console interface for demo | |
--CONSOLE = "DAHDI/1" | |
--CONSOLE = "Phone/phone0" | |
TRUNK = "DAHDI/G1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
''' | |
.ssh/config (windows,for local git server): | |
Host host100 | |
Hostname 192.168.1.100 | |
User git | |
IdentityFile C:/Users/admin/.ssh/id_rsa_gitBackup_host100 | |
repo example: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// can be run in go 1.0.3 | |
// build : go build netfwd.go | |
package main | |
import ( | |
"net" | |
"fmt" | |
"io" | |
"os" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
''' | |
CentOS 6.2 + Python 2.6 | |
''' | |
def getIpList(): | |
import os | |
ipList = [] | |
var = os.popen('ifconfig').read().split("\n\n") | |
for item in var: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
# a simple udp client | |
import socket,time,traceback | |
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
dstHost = ('192.168.1.100', 12345) | |
while True: | |
try: | |
client.sendto('3',dstHost) | |
print time.time(),' : send success' |
NewerOlder