Пример #1
0
def getSendDataHandler(participant,topic):
	localInterface = Support.doSubnetTranslation(topic.localInterface)

	if topic.transport == TRANSPORT_MC:
		return McSendDataHandler(localInterface,topic,topic.timeToLive)
	if topic.transport == TRANSPORT_UDP:
		return UdpSendDataHandler(topic)

	return None
Пример #2
0
def getReceiveDataHandler(participant,topic):
	key = __makeKey(topic)

	rdh = None
	if key in __ReceiveDataHandler:
		rdh = __ReceiveDataHandler[key]
		if max(rdh.topic.sampleMaxSize,topic.sampleMaxSize) > PACKET_MAX_SIZE:
			message = "Warning: "
			if topic.transport == TRANSPORT_UDP:
				message += "UDP Transport"
			else:
				message += "Same port (%s)" % topic.port
			message += " is used with Topics with 'sampleMaxSize' > %s" % PACKET_MAX_SIZE
			print message
	else:
		localInterface = Support.doSubnetTranslation(topic.localInterface)
		if topic.transport == TRANSPORT_MC:
			rdh = McReceiveDataHandler(localInterface,topic)
		if topic.transport == TRANSPORT_UDP:
			rdh = UdpReceiveDataHandler(localInterface,topic)
		rdh.start()
		__ReceiveDataHandler[key] = rdh
	return rdh