Ejemplo n.º 1
0

username = raw_input("Your username: "******"s11nChat", chatRcv)
chatPub = umundoS11n.TypedPublisher("s11nChat")
chatGrt = ChatGreeter(chatPub, chatSub, username, participants)

chatSub.registerType("ChatMsg", ChatMsg)
#chatPub.setGreeter(chatGrt)

node = umundo.Node()
node.addPublisher(chatPub)
node.addSubscriber(chatSub)

print("Start typing messages (empty line to quit):")

while True:
    inputmsg = raw_input("")
    if inputmsg == "":
        node.removePublisher(chatPub)
        node.removeSubscriber(chatSub)
        break

    msg = ChatMsg()
    msg.username = username
    msg.message = inputmsg
    chatPub.sendObject("ChatMsg", msg)
Ejemplo n.º 2
0

username = raw_input("Your username: "******"s11nChat", chatRcv)
chatPub = umundoS11n.TypedPublisher("s11nChat")
chatGrt = ChatGreeter(chatPub, chatSub, username, participants)

chatSub.registerType("ChatMsg", ChatMsg)
#chatPub.setGreeter(chatGrt)

node = umundo.Node()
node.addPublisher(chatPub)
node.addSubscriber(chatSub)

print("Start typing messages (empty line to quit):")

while True:
    inputmsg = raw_input("")
    if inputmsg == "":
        node.removePublisher(chatPub)
        node.removeSubscriber(chatSub)
        break

    msg = ChatMsg()
    msg.username = username
    msg.message = inputmsg
    chatPub.sendObject("ChatMsg", msg)