Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EpicsUDPConnection"/> class.
        /// </summary>
        /// <param name="ipe">
        /// The ipe.
        /// </param>
        internal EpicsUDPConnection(IPEndPoint ipe)
        {
            this.UDPSocket = UDPSocketManager.GetSocket(ipe);

            /*UDPSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
             * UDPSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
             * UDPSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
             * UDPSocket.Bind(ipe);*/
            this.Start();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "EpicsUDPConnection" /> class.
        ///   Client Constructor, will try to get his Port automaticly
        /// </summary>
        internal EpicsUDPConnection()
        {
            this.UDPSocket = UDPSocketManager.GetSocket();

            /*UDPSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
             * UDPSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
             * UDPSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
             *
             * //do a stupid send so that it get's himself an endpoint
             * UDPSocket.SendTo(new byte[1]{0}, new IPEndPoint(IPAddress.Parse("127.0.0.1"), 60000));*/
            this.Start();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The start.
        /// </summary>
        private void Start()
        {
            UDPSocketManager.Listen(this.UDPSocket, this.Listen);

            /*//start Receiver
             * tReceiver = new Thread(Listen);
             * tReceiver.IsBackground = true;
             * tReceiver.Start();*/

            // start Handler
            this.tHandler = new Thread(this.Handle);
            this.tHandler.IsBackground = true;
            this.tHandler.Start();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// The dispose.
        /// </summary>
        public void Dispose()
        {
            if (this.notDisposing)
            {
                this.notDisposing = false;
            }
            else
            {
                return;
            }

            /*UDPSocket.Close();
             * UDPSocket = null;*/
            UDPSocketManager.StopListen(this.UDPSocket, this.Listen);
            UDPSocketManager.DisposeSocket(this.UDPSocket);
        }