Ejemplo n.º 1
0
 def __init__(self, count):       
     # Create 'count' number relay hosts.
     for i in xrange(count):
         relay = pyinsim.relay(name='Relay %d' % (i + 1))
         relay.hosts = [] # Give each relay its own host list.
         
         # Bind events.
         relay.bind(pyinsim.IRP_HOS, self.host_list)
         relay.bind(pyinsim.IRP_ERR, self.relay_error)
         relay.bind(pyinsim.ISP_NCN, self.new_connection)
         
         # Request host list.
         relay.send(pyinsim.IRP_HLR)
         
     # Start pyinsim.
     pyinsim.run()
Ejemplo n.º 2
0
"Example: Shows how to use InSim relay to select a single host."

import pyinsim

# Replace with host name
HOST_NAME = 'Dead Men Racing'

def new_connection(relay, ncn):
    # Print out connection name.
    print 'New Connection:', ncn.UName

# Initialize relay host.
relay = pyinsim.relay(HName=HOST_NAME)

# Bind events.
relay.bind(pyinsim.ISP_NCN, new_connection)

# Request connection list from host.
relay.send(pyinsim.ISP_TINY, ReqI=255, SubT=pyinsim.TINY_NCN)

# Run pyinsim.
pyinsim.run()
Ejemplo n.º 3
0
"Example: Shows how to use InSim relay to select a single host."

import pyinsim

# Replace with host name
HOST_NAME = 'Dead Men Racing'


def new_connection(relay, ncn):
    # Print out connection name.
    print 'New Connection:', ncn.UName


# Initialize relay host.
relay = pyinsim.relay(HName=HOST_NAME)

# Bind events.
relay.bind(pyinsim.ISP_NCN, new_connection)

# Request connection list from host.
relay.send(pyinsim.ISP_TINY, ReqI=255, SubT=pyinsim.TINY_NCN)

# Run pyinsim.
pyinsim.run()