Parameters
- Socket
- The underlying socket
- Stream
- A stream based on that socket
Normally this is all handled internally by DicomObjects, but this method is provided for developers who may wish to use their own listening and authorisation mechanisms
Note that only one association is allowed per TCP connection, so this does require a "new" TCP connection, though TLS negotiation etc. may of course have been performed.
int port = 104; TcpListener listener = new TcpListener(System.Net.IPAddress.Any, port); listener.Start(); while (true) { // Step 1: Accept a new TCP connection TcpClient client = listener.AcceptTcpClient(); Console.WriteLine("New connection accepted."); // Step 2: Get the underlying socket and network stream Socket socket = client.Client; NetworkStream stream = client.GetStream(); // Step 3: Pass the connection to DICOM for association negotiation Server.Accept(socket, stream);