![]()  | 
	
| 
		 
			 
			#1  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
				
				Problem with server Events
			 
			
			
			We're having a problem creating a simple server/client model where users log in and they can move around in the same world. We used the duck default model as avatars. I can paste the code in but lets see if i'm missing something obvious 
		
		
		
		
		
		
		
		
	
	The problem is with the events. Both server and client have the code SEND = viznet.id('send') and I then I do something in the client like viznet.callback(SEND, update) and this calls a function that updates the location of all the ducks. The code doesn't work because I never get something sent using the event id SEND for any of the clients. BUT, if I replace SEND with viz.NETWORK_EVENT, everything works as expected. But this is obviously problematic because it triggers on every event, and not all of the events are updates. I tried printing out the value of UPDATE and its some crazy negative number, however it is the same number on both the server and client. The relevant client code: Code: 
	ducks = {}
UPDATE = viznet.id('update')
SEND = viznet.id('send')
def sendData():
	global UPDATE
	viznet.client.sendAll(UPDATE, client=viz.getComputerName(), ori = viz.MainView.getEuler(), pos = viz.MainView.getPosition())
def update(e):
	print 'hello'
	if e.client != viz.getComputerName():
		try:
			ducks[e.client].setPosition(e.pos)
			ducks[e.client].setEuler(e.ori)
		except KeyError:
			ducks[e.client] = viz.add('duck.wrl')
			ducks[e.client].setPosition(e.pos)
			ducks[e.client].setEuler(e.ori)
viz.callback(SEND,update)
vizact.ontimer(0.1, sendData)
Code: 
	viznet.server.start(port_in=14950, port_out=14951)
ducks = {}
UPDATE = viznet.id('update')
SEND = viznet.id('send')
def Update(e):
	ducks[e.sender].setPosition(e.pos)
	ducks[e.sender].setEuler(e.ori)
viz.callback(UPDATE, Update)
def onStartClient(e):
	print '**Client Joined:', e.sender
	ducks[e.sender] = viz.add('duck.wrl')
	
viz.callback(viznet.CLIENT_CONNECT_EVENT, onStartClient)
def onStopClient(e):
	print '** Client left:', e.sender
	ducks[e.sender].remove()
viz.callback(viznet.CLIENT_DISCONNECT_EVENT, onStopClient)
 | 
| Thread Tools | |
| Display Modes | Rate This Thread | 
		
  | 
	
		
  | 
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Client Server Networking Problem | pattie | Vizard | 12 | 07-04-2013 10:11 AM | 
| Linking problems with Live Character | Frank Verberne | Vizard | 5 | 06-04-2008 12:42 PM | 
| Floating license server problems | jrodman | Vizard | 2 | 10-30-2006 11:39 AM | 
| Intersense Server & 3d Max | Hodge1620 | Vizard | 4 | 10-26-2005 02:39 PM | 
| problem with female animations | vmonkey | Vizard | 1 | 10-07-2005 11:36 AM |