public SocketHandler GetSocket(string machinePortAndSid, bool openNew)
 {
     RemoteConnection connection = (RemoteConnection) _connections[machinePortAndSid];
     if (openNew || (connection == null))
     {
         connection = new RemoteConnection(this, machinePortAndSid);
         lock (_connections)
         {
             _connections[machinePortAndSid] = connection;
         }
     }
     return connection.GetSocket();
 }
Exemple #2
0
        // The key is expected to of the form "machinename:port"
        public SocketHandler GetSocket(String machineAndPort)
        {
            RemoteConnection connection = (RemoteConnection)_connections[machineAndPort];
            if (connection == null)
            {
                connection = new RemoteConnection(this, machineAndPort);

                // doesn't matter if different RemoteConnection's get written at
                //   the same time (GC will come along and close them).
                lock (_connections)
                {
                    _connections[machineAndPort] = connection;
                }
            }

            return connection.GetSocket();
        } // GetSocket