• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python server.server函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中server.server函数的典型用法代码示例。如果您正苦于以下问题:Python server函数的具体用法?Python server怎么用?Python server使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了server函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: clientLaunch

def clientLaunch():
	print ("Starting client")
	
	server.server()
	
	print ()
	
开发者ID:Reedych456,项目名称:dosierareto,代码行数:6,代码来源:client.py


示例2: start_server

	def start_server(self, *args):
		args = args[0]
		name = args[0]
		if name in self.serverManager.server_data.keys():
			if not (name in self.serverManager.servers.keys()):
				self.serverManager.servers[name] = server(self.serverManager.server_data[name], self.messageQueue)
				self.serverManager.servers[name].start()
			elif not self.serverManager.servers[name].is_alive():
				self.serverManager.servers[name] = server(self.serverManager.server_data[name], self.messageQueue)
				self.serverManager.servers[name].start()
			else:
				return name + " is already running."
		else:
			return name + " is not a valid server name."
		return "success"
开发者ID:MorganBorman,项目名称:pyServerManager,代码行数:15,代码来源:command_handler.py


示例3: __init__

	def __init__(self):
		#this function will do what is necessary to load preferences, create an empty server,
		#etc, etc
		self.serverlist = []
	#	self.s = server.server(self.tk, hostname='irc.synirc.org', nick='zobzan' )
		self.createtk()
		self.s = server.server(self.tk, hostname='irc.synirc.org', nick='zobzan' )
开发者ID:keyvin,项目名称:simplepychat,代码行数:7,代码来源:main.py


示例4: __init__

    def __init__(self, name, M0b=18, M0f=23, M1b=24, M1f=25, T1=4, E1=17, simulation=False):
#GPIO: 4 17 21 22
#pin : 7 11 13 15

#GPIO: 18 23 24 25
#pin : 12 16 18 22

        self.logger = logging.getLogger('myR.rover')
        self.name = name
        self.version = 1
        self.simulation = simulation
        self.ip = '192.168.0.10'
        self.speed = 100  # [mm/s]
        self.speedMax = 1000  # [mm/s]

        self.voltage = 6  # [V]
        self.mass = 2  # [Kg]
        self.Lenght = 180  # [mm]
        self.wheelR = 32  # [mm]

        self.time360 = 2  # [sec]

        self.data = datacollector()
        self.camera = camera(self.data)
        self.camserver = camserver(self.data)
        self.sensor = us_sensor('S1', T1, E1, self.data)
        self.motorLeft = DCmotor('MLeft', M0b, M0f, 11, 12)
        self.motorRight = DCmotor('MRight', M1b, M1f, 13, 14)

        self.rc = rc(self.data)
        self.server = server(self.data)
开发者ID:solenerotech,项目名称:myRover,代码行数:31,代码来源:rover.py


示例5: start

	def start(self, board, camera):
		self.hello = "hello"
		test = "test"
		self.board = board
		self.camera = camera
		self.webServer = server.server(80, self.board, self.camera)
		self.webServer.start(True)
开发者ID:PeterBee97,项目名称:Multiwii-raspberry-drone-server,代码行数:7,代码来源:main.py


示例6: activate

	def activate(self):
		ret = super(xen_driver, self).activate()
		if ret: return ret

		# get server object to work with
		srv = server.server(self.server)

		# get the kernel number from the grub config
		(_,stdout,_) = srv.do_execute(
			"/usr/bin/env grep -E \"^[ ]*title\" %s | " %
				glob.config.get("paths", "grub_config") +
			"/usr/bin/env grep -B 1000 xen | /usr/bin/env wc -l"
		)

		grub_number = int(stdout[0])-1

		# set the xen to boot as the default kernel
		srv.do_execute(
			"/usr/bin/env sed -r \"s/^[ ]*default[ ]*=.*$/default=%s/g\" " %
				grub_number +
			"-i %s" % glob.config.get("paths", "grub_config")
		)

		# reboot if necessary
		if self.reboot:
			# backgrounded, just in case it matters
			srv.do_execute("%s -r now &" % glob.config.get("paths", "shutdown"))

		return errors.throw(errors.ERR_SUCCESS)
开发者ID:BCable,项目名称:panenthe,代码行数:29,代码来源:xen_driver.py


示例7: install

	def install(self):
		ret = super(xen_driver, self).install()
		if ret: return ret

		# get server object to work with
		srv = server.server(self.server)

		# see if it's already installed
		ret = self.__installed(srv)
		if ret == errors.DRIVER_ALREADY_INSTALLED:
			return ret

		# get distro
		distro = srv.get_remote_distro()

		if distro == "redhat":
			# get YUM package
			(exit_code,_,_) = srv.do_execute(
				"yum -y install xen xen-libs kernel-xen"
			)

			if exit_code != 0:
				return errors.throw(errors.DRIVER_INSTALL_FAIL)

			return errors.throw(errors.ERR_SUCCESS)

		return errors.throw(errors.DRIVER_OS_NOT_SUPPORTED)
开发者ID:BCable,项目名称:panenthe,代码行数:27,代码来源:xen_driver.py


示例8: __init__

 def __init__(self, **kwargs):
   super(Game, self).__init__(**kwargs)
   self.players = []
   self.player_count = 0
   self.animals = []
   self.vision = Vision()
   self.server = server(self.send_status, self.add_player, self.remove_player)
   self.server.main()
开发者ID:jesseanderson,项目名称:GoatsWithoutHats,代码行数:8,代码来源:main.py


示例9: main

def main():
    """ 
    Main event loop that launches a Clue-Less server and listens for incoming
    connections and messages from clients.
    """
    s = server.server('192.168.100.14', 4004)
    #s = server.server('10.0.1.10', 4004)
    
    while True:
        try:
            # Accept new connections
            if s.acceptingConnections:
                while True:
                    try:
                        conn, addr = s.accept()
                    except:
                        break
                    s.acceptConnection(conn)

            # Read from connections
            for name, conn in s.users.items():
                try:
                    r = conn.recv(1024).strip()
                except socket.error:
                    continue
                message = s.decrypt(r)
                if '::' in message:
                    splt = message.split('::')
                    if splt[0] == 'function':
                        splt2 = splt[1].split(':')
                        if splt2[0] == 'createNewGame':
                            s.createNewGame()
                        elif splt2[0] == 'joinGame':
                            s.joinGame(name, splt2[1])
                        elif splt2[0] == 'ready':
                            s.addReadyPlayer(name)
                        elif splt2[0] == 'start':
                            s.startGame(name)
                        elif splt2[0] == 'movePlayer':
                            s.handleMove(name,splt2[1])
                        elif splt2[0] == 'endTurn':
                            s.endTurn(name)
                        elif splt2[0] == 'makingSuggestion':
                            s.handleSuggestion(name,splt2[1])
                        elif splt2[0] == 'revealCard':
                            s.revealCard(name,splt2[1],splt2[2])
                        elif splt2[0] == 'makingAccusation':
                            s.handleAccusation(name,splt2[1])
                    elif splt[0] == 'message':
                        s.broadcastMessageToAll(0, '%s> %s' % (name, splt[1]))
                else:
                    if not message:
                        # Empty string is given on disconnect
                        s.removePlayer(name)
            time.sleep(.1)
        except (SystemExit, KeyboardInterrupt):
            break
开发者ID:jalbright1010,项目名称:ClueLess,代码行数:57,代码来源:run.py


示例10: runAll

    def runAll(self):      
        count = 1
        serv = server('192.168.2.103',52000)
        serv1 = server('192.168.2.103',52002)
        serv2 = server('192.168.2.103',52001)
        accel = accelerometer()
        meas = measure()
        bAndT = batteryandtemp()
        print bAndT.Batt[0]
        print bAndT.Temp[0]
        print bAndT.stopBase[0]
        print bAndT.stopRadiom[0]
        thread1 = threading.Thread(target=serv.listun,args=(0, accel,meas,bAndT))
        thread2 = threading.Thread(target=serv1.listun,args=(1,accel,meas,bAndT))
        thread3 = threading.Thread(target=serv2.listun,args=(2,accel,meas,bAndT))
        thread1.start()
        thread2.start()
        thread3.start()
        while count == 1 :
            serv.data = map(TramAction, serv.dataT)
	    self.currentState.run(serv,serv2,accel,meas,bAndT)

            if((bAndT.Batt[0] != 0.0 and bAndT.Batt[0] < 11.75) or (bAndT.Temp[0] != 0.0 and bAndT.Temp[0] > 40) or int(bAndT.stopBase[0]) == int(1.0) or int(bAndT.stopRadiom[0]) == int(1.0)) :
                serv.dataT[0] = (str("shutdown"))
                serv.data = map(TramAction, serv.dataT)
                 
            if str(serv.data[0]) == str('measure'):
                serv2.wait=1


	    self.currentState = self.currentState.next(serv.data[0])

	    if(thread1.isAlive() == False) :
                thread1 = threading.Thread(target=serv.listun,args=(0, accel,meas,bAndT))
                thread1.start()

	    if(thread2.isAlive() == False) :
                thread2 = threading.Thread(target=serv1.listun,args=(1,accel,meas,bAndT))
                thread2.start()

            if(thread3.isAlive() == False) :
                thread3 = threading.Thread(target=serv2.listun,args=(2,accel,meas,bAndT))
                thread3.start()
开发者ID:bcmcalister,项目名称:tramCode,代码行数:43,代码来源:StateMachine.py


示例11: main

def main():
	#print "[b]roadcast or [l]isten? Why not both!"

	print "Looking for already existing network of elevators"

	heis = client()
	try:
		result = 0
		for i in range(1): # Try 3 times to connect
			result = heis.start()

			if result == 2: # 
				print "DURR"
				break

			elif result == 0:
				while heis.alive: sleep(0.2)
				print "Server died, my turn to take over"
				synch = heis.server_synch
				ip = heis.my_address
				hardware = heis.elevator_hardware
				heis.delete()
				heis = server(synch[0].keys(), synch[0], ip, synch[1], hardware)
				print "Takin ova"
				heis.start()
				break

		if result == 1:
			print "I am now master"
			ip = heis.my_address
			hardware = heis.elevator_hardware
			heis.delete()
			heis = server(my_ip=ip, elevator_hardware=hardware)
			heis.start()

	except:
		print "FAIL"
		print sys.exc_info()[0]
		print traceback.print_tb(sys.exc_info()[2])
	heis.delete()
	heis.delete_driver()
	exit()
开发者ID:TTK4145-Project,项目名称:TTK4145-Project,代码行数:42,代码来源:main.py


示例12: __init__

	def __init__(self):
		#read glade file
		self.builder = gtk.Builder()
		self.builder.add_from_file("rad_gui.glade")
		#init server
		self.server = server.server(self,on_new_client_callback,on_recv_msg_callback)
		self.server.start()
		#get the main window, and connect all eventes
		self.window = self.builder.get_object("MainForm")
		if self.window:
			self.builder.connect_signals(self)
			self.window.show()
开发者ID:singleway,项目名称:pycommunication,代码行数:12,代码来源:main.py


示例13: server

def server(args):
    """
    Creates a server and sends all inputs to connected clients
    """
    # Create the server object
    test = sillystream_server.server()
    # Start the server in a thread
    test.start_thread(**args)
    # In python 2x you need to send a ctrl-d to flush the buffer
    # and send everything you have typed and hit enter on
    for send in sys.stdin:
        # Python 2x reads in unicode weird
        if (sys.version_info < (3, 0)):
            send = send.decode(constants.ENCODEING)
        # Send any input
        test.write(send)
开发者ID:pdxjohnny,项目名称:sillystream,代码行数:16,代码来源:__main__.py


示例14: run

  def run(self):
    s = server(self.host, self.port, self.username, None)

    try:
      if(not s.has_dir(self.path)):
        s.mkdir(self.path)
        s.init_git(self.path)
        s.add_remote(self.path, "github", "git://github.com/" + self.gh_username + "/" + self.repo + ".git")

      if not ("github" in s.get_remotes(self.path)):
        s.add_remote(self.path, "github", "git://github.com/" + self.gh_username + "/" + self.repo + ".git")

      s.pull(self.path, "github", self.branch)

      print s.stdout + "\n========\n\n" + s.stderr
    except Exception as ex:
      print ex.__str__()
开发者ID:tylermenezes,项目名称:GitDeploy,代码行数:17,代码来源:deploy_worker.py


示例15: add_once

	def add_once(self, host, port, selfreg=False, suggested=False, persistent=False, force=False, checkport=True, file=None, quicktest=False): # add server if it doesn't already exist, return (serverobject, existed)
		if (not force) and self._isbanned(host, port):
			debug.msg(serverlist.DBGTAG_REFUSED, "refused a banned server at %s:%d" % (host, port))
			return None, False
		else:
			if checkport and (port < 0 or port > 65534):
				debug.msg(serverlist.DBGTAG_INVALIDPORT, "trying to add a new server with an invalid port: %s:%d" % (host, port))
				return
			s = self.find(host, port)
			if s:
				existed = True
			else:
				s = server(host, port)
				self._append(s)
				existed = False
			if selfreg: s.selfreg = True # whether this server has registered itself to gamemod (and not arrived via sauerbraten.org)
			if (not existed) and suggested: s.suggested = True # whether this server has been suggested to gamemod and was unknown before (and not arrived via sauerbraten.org)
			if persistent: s.persistent = True # whether this server should never be kicked from the pending servers list
			if file: s.fromfile = file
			if (not existed) and quicktest: s.quicktest = True # whether this server should be tested for registration quickly (= kick it if it does not already reply within one request and config.PING_INTERVAL)
			return s, existed
开发者ID:xthirtyfive,项目名称:gamemod,代码行数:21,代码来源:serverlist.py


示例16: train

def train(num_training=20, num_test=10):
    input_files = glob.glob('MovieReviews/txt_sentoken/pos/*.txt')
    s = server(MAX=int(sys.argv[1]))
    A = [(inp, 'pos') for inp in input_files[0:num_training]]
    input_files = glob.glob('MovieReviews/txt_sentoken/neg/*.txt')
    A.extend([(inp, 'neg') for inp in input_files[0:num_training]])
    s.addJobs(A)
    #print A
    print "Traing classifier on the following files: "
    #print "File name          file type"
    headers = ["File Name", "file review type"]
    table = zip([i[0][30:len(i[0])-1] for i in A], [i[1] for i in A])
    print tabulate(table, headers, tablefmt="grid")
    """
    for i in A:
	print i[0][26:len(i[0])-1],
        print "       ",
	print i[1]
    """
    training = s.start()
    cl = NaiveBayesClassifier(training)
    return cl
开发者ID:kaushik94,项目名称:GridComputing,代码行数:22,代码来源:classifier.py


示例17: cron_daily

    def cron_daily(self):
        # get servers
        ac = api.api_call("server_list", {})
        ret = ac.execute()
        if ret != errors.ERR_SUCCESS:
            return ret
        servers = ac.output()

        # loop servers
        for remote_server_dict in servers:
            # nothing update on master
            if remote_server_dict["parent_server_id"] == 0:
                continue

                # master
            server_dict = self.get_dict()
            # slave
            server_dict["remote_server"] = remote_server_dict

            # call its cron_daily command
            server_obj = server(server_dict)
            ret = server_obj.cron_daily()
            if ret != errors.ERR_SUCCESS:
                return ret
开发者ID:BCable,项目名称:panenthe,代码行数:24,代码来源:master.py


示例18: test_warn_only_does_not_imply_hide_everything

    @server()
    @mock_streams("both")
    def test_warn_only_does_not_imply_hide_everything(self):
        run("ls /simple", warn_only=True)
        assert sys.stdout.getvalue() != ""


class TestMultipleOKReturnCodes(FabricTest):
    @server(responses={"no srsly its ok": ["", "", 1]})
    def test_expand_to_include_1(self):
        with settings(quiet(), ok_ret_codes=[0, 1]):
            eq_(run("no srsly its ok").succeeded, True)


slow_server = server(responses={"slow": ["", "", 0, 3]})
slow = lambda x: slow_server(raises(CommandTimeout)(x))


class TestRun(FabricTest):
    """
    @server-using generic run()/sudo() tests
    """

    @slow
    def test_command_timeout_via_env_var(self):
        env.command_timeout = 2  # timeout after 2 seconds
        with hide("everything"):
            run("slow")

    @slow
开发者ID:dmuralik,项目名称:datascience,代码行数:30,代码来源:test_operations.py


示例19: server

#! /usr/bin/python
# -*- coding:utf-8 -*-
import os
import sys

sys.path.append(os.path.abspath(os.path.abspath(".") + os.sep + ".."))

from server import server

if __name__ == "__main__":
    _server = server(dbserver="localhost", svcname=11810, usr="root", passwd="admin")
    _server.run(10086, 10)
开发者ID:tynia,项目名称:logAnalysis,代码行数:12,代码来源:run.py


示例20: started

# Der oprettes henvisninger til klasser så de kan bruges som argumenter til
# andre metoder
clients = server.clients()
cv = threading.Event()


# En tråd til at sende seriel data til klienterne oprettes
sender = server.serialSendToClients(cv, clients, "Consumer",)
sender.setDaemon(True)
sender.start()


# En tråd til at modtage seriel data fra bilen oprettes
serial = server.serial(cv, ser, sender)
serial.setDaemon(True)
serial.start()


print "Server started (Port: %d)," %PORT


while True:
    # Der oprettes en tråd for hver klient der tilslutter
    conn, addr = s.accept()
    clients.addClient(conn, addr)
    th = server.server(args=(conn, addr, clients))
    th.setDaemon(True)
    th.start()

开发者ID:Den7710,项目名称:Unicorn_race_engineering,代码行数:28,代码来源:main.py



注:本文中的server.server函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python server.start函数代码示例发布时间:2022-05-27
下一篇:
Python server.run函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap