/// <summary> /// Constructs the Messagizer as a session of transport using uri and resources. /// </summary> /// <param name="transport">used to deliver packets to the peer.</param> /// <param name="uri">the uri being used to configure the transport stack.</param> /// <param name="resources">the associated set of resources for this service.</param> public Messagizer(TransportPacket transport, URL uri, Resources resources) { // find the format. this.transport = transport; String format = uri.GetTerm(FORMAT, FormatFactory.BINARY); // find the format factory. FormatFactory ff = FormatFactory.Get(format); if (ff == null) { throw new ArgumentException( String.Format("format factory is not defined as '{0}' in format factories", format)); } // find the value factory. ValueFactory vf = ( ValueFactory )resources.Get(TransportConsts.VALUE_FACTORY); if (vf == null) { throw new ArgumentException(String.Format( "value factory is not defined as '{0}' in resources", TransportConsts.VALUE_FACTORY)); } tdi = ff.NewTaggedDataInput(vf, uri.ToString()); tdo = ff.NewTaggedDataOutput(vf, uri.ToString()); transport.SetSession(this); }
public MyPacketHandler(TransportPacket tp) { _tp = tp; _tp.SetSession(this); }