WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-18-2012, 10:58 AM
fordprefect fordprefect is offline
Member
 
Join Date: Oct 2012
Location: Vienna, Austria, Europe
Posts: 39
continued

No luck with an answer yet, so I look for a work-around myself. Extend the communication protocol with a connection-test and connect-confirm network events
Code:
import viz
import viznet

CONN_TEST = viznet.id("connTest")
CONN_CONF = viznet.id("connConf")

myName = viz.net.getName()
and, for testing reasons, just try to confirm a connection between MASTER and HEAD1, running the same script on each machine:
Code:
if myName == 'HEAD1':
    doClient()
else:
    doServer()

viz.go()
with the server part:
Code:
def srvrConnectTest(e):
    viznet.server.sendClient(e.client, CONN_CONF, server=myName)
    print 'connect confirmation sent'

def doServer():
    viznet.server.start()
    viz.callback(CONN_TEST, srvrConnectTest)
and the client code being:
Code:
import threading
_TIMEOUT = 3.0
_myServer = None
_confirmEvent = threading.Event()

def clntConnectConfirm(e):
    _myServer = e.server
    print 'received confirmation from', e.server
    _confirmEvent.set()

def doClient():
    _lookfor = 'MASTER'
    if not viznet.client.connect(_lookfor):
        print _lookfor, 'does not run'
    else:
        viz.callback(CONN_CONF, clntConnectConfirm)
        print 'asking for connection confirmation...'
        viznet.client.send(CONN_TEST, client=myName)
        _confirmEvent.clear()
        _confirmEvent.wait(_TIMEOUT)
        print 'the server's name is', _myServer
but this does not work as it seems that the event queue is only worked upon when the script is completed: the wait time on the Event is always used up, the server replies immediately and the client does only react on the event in the very end. (relevant) Output on the client is:
Code:
asking for connection confirmation...
the server's name is None
received confirmation from MASTER
Any idea what I have to do to get the information in time, when I need it, and not ages later??

Thanks,
Best Regards,
Walter
__________________
21 is only half the truth.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection problems from MotionBuilder to PPT nachac Precision Position Tracker (PPT) 2 07-27-2010 08:29 AM
problems nagivating around ruby21 Vizard 2 05-18-2010 03:22 PM
Problems loading WRL file DrunkenBrit Vizard 2 01-29-2009 12:58 AM
Problems Importing VRML Files oscar Vizard 4 10-13-2004 05:42 PM
Problems with lighting in 2.0 murm Vizard 6 04-21-2004 09:59 AM


All times are GMT -7. The time now is 02:33 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC