Пример #1
0
        public CustomClient(string name)
        {
            ClientName = name;

            ClientIP = ClientHost + "." + ClientPort.ToString();

            ipEndPoint = new IPEndPoint(IPAddress.Any, 0);
            UdpClient  = new UdpClient(ipEndPoint);
            UdpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
        }
Пример #2
0
        private void ThrowSecurityException(string msg)
        {
            msg += " ip=" + ClientIp + " port=" + ClientPort;

            Error(msg);
            throw (new ExceptionSecurityThreat(msg)
            {
                ClientIp = ClientIp,
                ClientPort = ClientPort.ToString()
            }

                   );
        }
Пример #3
0
 public static void SaveSetting()
 {
     reader.SetNodeText("PingTimeout", PingTimeout.ToString());
     reader.SetNodeText("RequestTimeout", RequestTimeout.ToString());
     reader.SetNodeText("TcpPort", TcpPort.ToString());
     reader.SetNodeText("UdpPort", UdpPort.ToString());
     reader.SetNodeText("ClientPort", ClientPort.ToString());
     reader.SetNodeText("Adapter", Adapter);
     reader.SetNodeText("PlayerID", PlayerID);
     reader.SetNodeText("DataMode", dataMode);
     reader.SetNodeText("SyncMode", syncMode);
     reader.Save("setting.xml");
 }
Пример #4
0
 /// <summary>
 /// Format the data section of a FTP termination record.
 /// </summary>
 /// <returns>String representation of a FTP termination record.</returns>
 public override string ToString()
 {
     return(StartTime.ToString().PadRight(22, ' ')
            + "  " + EndTime.ToString().PadRight(22, ' ')
            + "  " + VseTaskId.ToString().PadRight(2 + 5, ' ')
            + "  " + FtpNodeName.PadRight(16, ' ')
            + "  " + FtpUserId.PadRight(8, ' ')
            + "  " + VseIp.PadRight(15, ' ')
            + "  " + VsePort.ToString().PadRight(8, ' ')
            + "  " + ClientPort.ToString().PadRight(11, ' ')
            + "  " + ClientIp.PadRight(15, ' ')
            + "  " + ForeignDataIp.PadRight(15, ' ')
            + "  " + FilesSent.ToString().PadRight(10, ' ')
            + "  " + FilesReceived.ToString().PadRight(10, ' ')
            + "  " + BytesSentAcked.ToString().PadRight(20, ' ')
            + "  " + BytesReceived.ToString().PadRight(20, ' ')
            + "  " + GeneralFlagFormatter(GeneralFlag).PadRight(8, ' ')
            + "  " + SslFlagFormatter(SslFlag).ToString().PadRight(5, ' '));
 }
Пример #5
0
 private void Connect()
 {
     try
     {
         Console.WriteLine("Connecting to {0}:{1}", ClientIp, ClientPort.ToString());
         server = new TcpListener(IPAddress.Parse(ClientIp), ClientPort);
         TerminateConnection = false;
         server.Start();
         ConnectionHandler();
     }
     catch (SocketException e)
     {
         Console.WriteLine("Socket Exception: {0}", e);
     }
     catch (Exception e)
     {
         Console.WriteLine("Unknown Exception: {0}", e);
     }
     finally
     {
         server.Stop();
     }
 }
Пример #6
0
        private void OptionsDialog_Load(object sender, EventArgs e)
        {
            _initializing                            = true;
            _textBoxClientAE.Text                    = ClientAE;
            _textBoxClientPort.Text                  = ClientPort.ToString();
            _textBoxClientCertificate.Text           = ClientCertificate;
            _textBoxPrivateKey.Text                  = PrivateKey;
            _textBoxKeyPassword.Text                 = PrivateKeyPassword;
            _checkBoxLogLowLevel.Checked             = LogLowLevel;
            _checkBoxGroupLengthDataElements.Checked = GroupLengthDataElements;
            _radioButtonWaitForResults.Checked       = StorageCommitResultsOnSameAssociation;
            _radioButtonNoWaitForResults.Checked     = !StorageCommitResultsOnSameAssociation;
            switch (_compression)
            {
            case Leadtools.Dicom.Scu.Common.Compression.Native:
                _radioButtonCompressionNative.Checked = true;
                break;

            case Leadtools.Dicom.Scu.Common.Compression.Lossy:
                _radioButtonCompressionLossy.Checked = true;
                break;

            case Leadtools.Dicom.Scu.Common.Compression.Lossless:
                _radioButtonCompressionLossless.Checked = true;
                break;
            }
#if !LEADTOOLS_V19_OR_LATER
            _groupBoxStorageCommit.Visible   = false;
            this._groupMiscellaneous.Visible = false;
#endif

            _listViewCipherSuites.InitializeCipherListView(CipherSuites, imageListCiphers);
            _checkBoxTlsOld.Checked = CipherSuites.ContainsOldCipherSuites();

            _initializing = false;
            EnableDialogItems();
        }
Пример #7
0
        public void Save(string fileName)
        {
            using (XmlTextWriter xml = new XmlTextWriter(fileName, Encoding.UTF8))
            {
                xml.Formatting = System.Xml.Formatting.Indented;
                xml.WriteStartDocument(true);
                xml.WriteStartElement("configuration");
                xml.WriteStartElement("settings");

                xml.WriteStartElement("server");
                xml.WriteAttributeString("ip", ServerIP.ToString());
                xml.WriteAttributeString("port", ServerPort.ToString());
                xml.WriteAttributeString("password", Password);
                xml.WriteEndElement();

                xml.WriteStartElement("client");
                xml.WriteAttributeString("port", ClientPort.ToString());
                xml.WriteEndElement();

                xml.WriteEndElement();
                xml.WriteEndElement();
                xml.WriteEndDocument();
            }
        }
Пример #8
0
        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            StringBuilder transportString = new StringBuilder();

            transportString.Append(Transport.ToString());
            transportString.Append('/');
            transportString.Append(Profile.ToString());
            transportString.Append('/');
            transportString.Append(LowerTransport.ToString());
            if (LowerTransport == LowerTransportType.TCP)
            {
                transportString.Append(";unicast");
            }
            if (LowerTransport == LowerTransportType.UDP)
            {
                transportString.Append(';');
                transportString.Append(IsMulticast ? "multicast" : "unicast");
            }
            if (Destination != null)
            {
                transportString.Append(";destination=");
                transportString.Append(Destination);
            }
            if (Source != null)
            {
                transportString.Append(";source=");
                transportString.Append(Source);
            }
            if (Interleaved != null)
            {
                transportString.Append(";interleaved=");
                transportString.Append(Interleaved.ToString());
            }
            if (IsAppend)
            {
                transportString.Append(";append");
            }
            if (TTL > 0)
            {
                transportString.Append(";ttl=");
                transportString.Append(TTL);
            }
            if (Layers > 0)
            {
                transportString.Append(";layers=");
                transportString.Append(Layers);
            }
            if (Port != null)
            {
                transportString.Append(";port=");
                transportString.Append(Port.ToString());
            }
            if (ClientPort != null)
            {
                transportString.Append(";client_port=");
                transportString.Append(ClientPort.ToString());
            }
            if (ServerPort != null)
            {
                transportString.Append(";server_port=");
                transportString.Append(ServerPort.ToString());
            }
            if (SSrc != null)
            {
                transportString.Append(";ssrc=");
                transportString.Append(SSrc);
            }
            if (Mode != null && Mode != "PLAY")
            {
                transportString.Append(";mode=");
                transportString.Append(Mode);
            }
            return(transportString.ToString());
        }
        private void OnClientPortChanged()
        {
            Logging.Logging.LogInfo("Changing Client Port to " + ClientPort.ToString());

            Utility.AsynchronousClient._port = ClientPort;
        }
        private void InitNetwork()
        {
            Logging.Logging.LogInfo("Initializing Network with Server Port " + ServerPort.ToString() + " and Client Port " + ClientPort.ToString());

            Utility.AsynchronousSocketListener._port = ServerPort;
            Utility.AsynchronousSocketListener server = new Utility.AsynchronousSocketListener();
            Utility.AsynchronousSocketListener._onReadCallback  = new Utility.AsynchronousSocketListener.OnReadCallback(OnNetworkReadCallback);
            Utility.AsynchronousSocketListener._onErrorCallback = new Utility.AsynchronousSocketListener.OnReadCallback(OnNetworkErrorCallback);
            _serverThread = new System.Threading.Thread(server.DoWork);
            _serverThread.Start();

            Utility.AsynchronousClient._port            = ClientPort;
            Utility.AsynchronousClient._onErrorCallback = new Utility.AsynchronousSocketListener.OnReadCallback(OnNetworkErrorCallback);
        }