Am 10.09.2013 14:57, schrieb Shyam B:
In the version update: http://trac.ibr.cs.tu-bs.de/project-cm-2012-ibrdtn/wiki/changelog: It says:
- Statistic Logger replaced by API management calls
What does this mean? If there is an API, where is it and what is the easy way of calling _this API_? I am programming in python..
#!/usr/bin/python # #
import socket import sys
HOST='localhost' PORT=4550
''' create a socket ''' try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) except socket.error, msg: sys.stderr.write("[ERROR] %s\n" % msg) sys.exit(1)
''' connect to the daemon ''' try: sock.connect((HOST, PORT)) fsock = sock.makefile() except socket.error, msg: sys.stderr.write("[ERROR] %s\n" % msg) sys.exit(1)
''' read header ''' fsock.readline()
''' switch into management protocol mode ''' sock.send("protocol management\n")
''' read protocol switch ''' fsock.readline()
''' query neighbor list ''' sock.send("neighbor list\n")
data = fsock.readline() while (len(data) > 1): sys.stdout.write(data) data = fsock.readline()
''' close the socket ''' sock.close()
''' finally exit the script ''' sys.exit(0)