当前位置: 首页>>代码示例>>Python>>正文


Python Packet.getCommand方法代码示例

本文整理汇总了Python中Packet.getCommand方法的典型用法代码示例。如果您正苦于以下问题:Python Packet.getCommand方法的具体用法?Python Packet.getCommand怎么用?Python Packet.getCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Packet的用法示例。


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

示例1: handle

# 需要导入模块: import Packet [as 别名]
# 或者: from Packet import getCommand [as 别名]
    def handle(self):
        msg = self.recv_with_size()
        print msg, type(msg)

        p = Packet()
        p.DecodePacket(msg)

        cmd = p.getCommand()
        if cmd == "put":
            self.handle_put(p)

        elif cmd == "get":
            self.handle_get(p)
开发者ID:NamcoPro,项目名称:Distributed-File-System,代码行数:15,代码来源:data-node.py

示例2: handle

# 需要导入模块: import Packet [as 别名]
# 或者: from Packet import getCommand [as 别名]
	def handle(self):
		msg = self.request.recv(1024) #From copyclient
		print msg, type(msg)

		p = Packet()
		p.DecodePacket(msg)

		cmd = p.getCommand()
		if cmd == "put":	#Putting data
			self.handle_put(p)

		elif cmd == "get":	#Getting data
			self.handle_get(p)
开发者ID:skytremor,项目名称:Distributed-File-System,代码行数:15,代码来源:data-node.py

示例3: handle

# 需要导入模块: import Packet [as 别名]
# 或者: from Packet import getCommand [as 别名]
	def handle(self):
		# Receive a msg from the copy client
		msg = self.request.recv(1024)

		# Define a packet object and decode it
		p = Packet()
		p.DecodePacket(msg)

		# Copy client asking for data node to put data
		cmd = p.getCommand()
		if cmd == "put":
			self.handle_put(p)

		# Copy client asking for data node to get data
		elif cmd == "get":
			self.handle_get(p)
开发者ID:jesspagan,项目名称:dfs_project,代码行数:18,代码来源:data-node.py

示例4: handle

# 需要导入模块: import Packet [as 别名]
# 或者: from Packet import getCommand [as 别名]
	def handle(self):

		# Establish a connection with the local database
		db = mds_db("dfs.db")
		db.Connect()

		# Define a packet object to decode packet messages
		p = Packet()

		# Receive a msg from the list, data-node, or copy clients
		msg = self.request.recv(1024)
		print msg, type(msg)
		
		# Decode the packet received
		p.DecodePacket(msg)
	

		# Extract the command part of the received packet
		cmd = p.getCommand()

		# Invoke the proper action 
		if   cmd == "reg":
			# Registration client
			self.handle_reg(db, p)

		elif cmd == "list":
			pass
			# Client asking for a list of files
			# Fill code
		
		elif cmd == "put":
			pass
			# Client asking for servers to put data
			# Fill code
		
		elif cmd == "get":
			pass
			# Client asking for servers to get data
			# Fill code

		elif cmd == "dblks":
			pass
			# Client sending data blocks for file
			 # Fill code


		db.Close()
开发者ID:dramirez2,项目名称:DFSystem,代码行数:49,代码来源:meta-data.py


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