diff --git a/examples/hello_accept.py b/examples/hello_accept.py index f5b91ee..0c10b81 100644 --- a/examples/hello_accept.py +++ b/examples/hello_accept.py @@ -1,23 +1,21 @@ # Copyright (C) 2008-2009 AG Projects. See LICENSE for details. # -import sys -from eventlib import proc -from msrplib.connect import AcceptorDirect +from msrplib.connect import DirectAcceptor from msrplib.protocol import URI from msrplib.trafficlog import Logger from msrplib.session import GreenMSRPSession -from twisted.internet import reactor # let eventlib know we want twisted-based hub +from twisted.internet import reactor; del reactor # let eventlib know we want twisted-based hub +logger = Logger() local_uri = URI(session_id='server', use_tls=False) remote_uri = URI(session_id='client', use_tls=False) -connector = AcceptorDirect(logger=Logger()) +connector = DirectAcceptor(logger=logger) connector.prepare(local_uri) transport = connector.complete([remote_uri]) session = GreenMSRPSession(transport) session.send_message('hello', 'text/plain') -print 'received: %s' % session.receive_chunk().data +logger.info('received: %s', session.receive_chunk().data) session.shutdown() - diff --git a/examples/hello_connect.py b/examples/hello_connect.py index b569bea..eea6f02 100644 --- a/examples/hello_connect.py +++ b/examples/hello_connect.py @@ -1,22 +1,21 @@ # Copyright (C) 2008-2009 AG Projects. See LICENSE for details. # -import sys -from eventlib import proc -from msrplib.connect import ConnectorDirect +from msrplib.connect import DirectConnector from msrplib.protocol import URI from msrplib.trafficlog import Logger from msrplib.session import GreenMSRPSession -from twisted.internet import reactor # let eventlib know we want twisted-based hub +from twisted.internet import reactor; del reactor # let eventlib know we want twisted-based hub +logger = Logger() local_uri = URI(session_id='client', use_tls=False) remote_uri = URI(session_id='server', use_tls=False) -connector = ConnectorDirect(logger=Logger()) +connector = DirectConnector(logger=logger) connector.prepare(local_uri) transport = connector.complete([remote_uri]) session = GreenMSRPSession(transport) session.send_message('hi', 'text/plain') -print 'received: %s' % session.receive_chunk().data +logger.info('received: %s', session.receive_chunk().data) session.shutdown()