ÓÃpythonдµÄÊý¾Ýת·¢³ÌÐò
#coding:utf-8
import socket,time,sys
def proxy_server():
client_addr = 0
conn = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
conn.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
conn_addr = ('192.168.0.10',9999)
conn.bind(('',2222))
while 1:
print "Start the proxy.........."
datas,addr = conn.recvfrom(1024)
if not addr[0] == '192.168.0.10':
try:
conn.sendto(datas,conn_addr)
client_addr = addr
except:
print "s"
else:
conn.sendto(datas,client_addr)
ÒÔÉÏ´úÂëÖ÷ҪʵÏÖÔÚ¾ÖÓòÍøÄÚA¿Í»§¶Ë·¢¸ø±¾»ú¶Ë¿Ú2222µÄudp°üת·¢¸ø192.168.0.10:9999£¬ËùÓÐ192.168.0.10:9999·¢ËÍ»ØÀ´µÄÊý¾Ý°üÔÙת·¢¸øA¿Í»§¶Ë£»
Ϊʲôֻ»áÖ´ÐÐ4Ìõ¡°Start the proxy..........¡±£¿²»»áһֱѻ·µÄÂð£¿ÄÇdatasÖ»ÊÇÆðÒ»¸ö»º³å³ØµÄ×÷ÓÃÂð£¿Èç¹ûÎÒÒªÈÃda
Ïà¹ØÎÊ´ð£º
×î½üÓÃpythonдһ¸ö³ÌÐò,×ÜÊÇÒì³£Í˳ö£¬µ«ÊÇȴû·¨ÓÃtry..exceptÀ´²¶×½
ÓÉÓÚû·¨·¢Í¼Æ¬£¬ËùÒÔ°ÑÏà¹ØµÄÐÅÏ¢´òÓ¡³öÀ´
Òì³£µÄÐÅÏ¢´óÖÂÈçÏ£º
python.exeÓöµ½ÎÊÌâÐèÒª¹Ø±Õ¡£ÎÒÃǶԴËÒýÆðµÄ²»±ã±íʾ±§Ç¸ ......
ËÍƼöÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл
¡¶python¼òÃ÷½Ì³Ì¡·£¬¡¶pythonºËÐıà³Ì¡·
×÷Ϊϵͳ¹ÜÀí·½Ã棬¡¶Python UNIXºÍLinuxϵͳ¹ÜÀíÖ¸ÄÏ¡·ÊDZ¾·Ç³£²»´íµÄÊé¡£
http://club.book.csdn.net/pic3/255142.jpg
ÒýÓÃ
×÷Î ......
ÔÚlistÖÐÌí¼ÓÒ»¸öÀàµÄ¾Ö²¿±äÁ¿ ÕâÑù×öÊÇ·ñºÏ·¨ Çë¿´ÏÂÃæÀý×Ó:
Python code:
class A():
def __init__( self ):
self.__a = 0
self.__b = 'hello'
def get_a( self ):
ret ......
ÎÒÏëÓÃpython½âÎöÍøÒ³ÖеÄurl ÔÚÏÂÔØ֮ǰ, ÎÒÏëÏÈ·¢Ò»¸öheadÇëÇó ²»ÐèÒªÏÂÔØÕû¸öÍøÒ³, ÏÈ»ñµÃ¸ÃÍøÕ¾µÄheadÐÅÏ¢, ¶ÁȡһЩÐÅÏ¢Ö®ºó ÔÚµ÷ÓÃÕâЩ¿âµÄread·½·¨À´¶ÁÈ¡Õû¸öÍøÒ³ ¸ÃÔõô²Ù×÷ÄØ ¶àл
°ï¶¥ÁË
ÓÐÈËÄÜÖ¸½ÌÒ» ......
ÇëÎʸßÊÖ£¬pythonÀïµÄpopenÀàËÆjavaÀïµÄÄĸöÀà»òÕß·½·¨ÄØ£¿£¿ÁíÍâjython¿ª·¢java¸ÃÈçºÎʹÓÃjythonÄØ£¿£¿
1.¿ÉÄܺÍjavaÀïµÄRuntime.getRuntime().exec£¨"ϵͳÃüÁî"£©; Æô¶¯½ø³Ì
2.eclipseÏÂÔØjython ²å¼ ......