1 import xmpp
2 import threading
3 import Agent
4 import Envelope
5 import FIPAMessage
6 import AID
7 import Behaviour
8 import ACLParser
9 import socket
10 import SocketServer
11
12 SIMBAPORT = 20001
13
14 -class SIMBA(Agent.PlatformAgent):
16 '''
17 Behaviour that routes outgoing SIMBA messages
18 '''
19
22
24 '''Sends a message to a SIMBA receiver'''
25
26
27 ip = to.strip("simba://")
28 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
29 try:
30 s.connect((ip, SIMBAPORT))
31 except:
32 print "Could not connect to SIMBA socket on " + str(ip)
33 s.send(str(msg))
34 s.close()
35
45
47 '''
48 Behaviour that routes incoming SIMBA messages
49 '''
50
52 '''
53 Request handler for SIMBA messages
54 '''
56 print "SIMBA SS: New incoming message"
57
62
63 - def __init__(self, node, password, server, port):
65
69