#
# Example use of BotSense.bsNull Module
#
import sys
# create a BotSense client
cli = bsTypes.BsClient('nullandvoid')
# connect to the bsProxy server using default IP address and port
try:
bsServer.ServerConnect(cli)
print inst
sys.exit(8)
# open a virtual connection to a proxied serial device
try:
hndVConn = bsNull.NullReqOpen(cli)
except bsError.BotSenseError, inst:
print inst
sys.exit(8)
print "Example: established virtual connection %d" % (hndVConn)
bitbucket = [
'into the bit bucket',
['a', 'b', 'c', 'd'],
'wheeee',
'\x01\x02\x03'
]
# write some data
for i in xrange(10):
j = i % len(bitbucket)
try:
except bsError.BotSenseError, inst:
print inst
sys.exit(8)
print "Example: %d: %s written" % (i, repr(bitbucket[j][:n]))
# close the virtual connection
try:
except bsError.BotSenseError, inst:
print inst
sys.exit(8)
# close the connection to the bsProxy server
try:
except bsError.BotSenseError, inst:
print inst
sys.exit(8)
# delete the client
del cli