Specifying outgoing IP when making a DICOM connection

      using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
            {
                var localEP = new IPEndPoint(IPAddress.Parse("outgoingIP"), 0);  0 means any available port
                socket.Bind(localEP);
                var remoteEP = new IPEndPoint(IPAddress.Parse("remoteIP"), remotePort);
                socket.Connect(remoteEP);
                NetworkStream ns = new NetworkStream(socket, true);                
                DicomAssociation cn = new DicomAssociation();
                cn.RequestedContexts.Add("1.2.840.10008.1.1");    
                cn.Open(socket, ns, "callingAET", "calledAET");
                int status = cn.Echo();
                cn.Close();
            }

Relevance: