public void SendMessage(AbstractDIMSERequest dimse, Entity ae) { var client = new TcpClient(); client.Connect(IPAddress.Parse(ae.IpAddress), ae.Port); var assoc = new Association(this, client) { AeTitle = ae.AeTitle }; PDataMessenger.Send(dimse, assoc); assoc.Listen(); }
/// <summary> /// Generates an association from a TCP client connection /// </summary> /// <param name="connection"></param> /// <returns></returns> private Association GenerateAssociation(TcpClient connection) { var asc = new Association(this, connection); Logger.Log("Starting association with {0}.", asc.IpAddress, asc.Port); //Add supported presentation contexts foreach (var ab in SupportedAbstractSyntaxes) { asc.PresentationContexts.Add(new PresentationContext() { AbstractSyntax = ab, TransferSyntaxes = SupportedTransferSyntaxes }); } return asc; }
public IEnumerable<CMoveResponse> GetResponse(CMoveRequest cMove, Entity ae) { var client = new TcpClient(); client.Connect(IPAddress.Parse(ae.IpAddress), ae.Port); var assoc = new Association(this, client) { AeTitle = ae.AeTitle }; PDataMessenger.Send(cMove, assoc); List<CMoveResponse> responses = new List<CMoveResponse>(); EvilDICOM.Network.Services.DIMSEService.DIMSEResponseHandler<CMoveResponse> action = null; action = (resp, asc) => { responses.Add(resp); if (resp.Status != (ushort)Status.PENDING) { this.DIMSEService.CMoveResponseReceived -= action; } }; this.DIMSEService.CMoveResponseReceived += action; assoc.Listen(); return responses; }