Exemple #1
0
        public void EntityPOSHostMessage1(IPEndPoint VTOLEndPoint, EntityHeaderVTOLListener HeaderVTOLListener, EntityPOSToHost POSToHost)
        {
            if ((POSToHost != null) || (HeaderVTOLListener != null) || (VTOLEndPoint != null))
            {
                this.HeaderVTOLListener = HeaderVTOLListener;
                this.POSToHost          = POSToHost;
                this.VTOLEndPoint       = VTOLEndPoint;

                try
                {
                    VTOLSocket                = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    VTOLSocket.SendTimeout    = 10000;
                    VTOLSocket.ReceiveTimeout = 10000;
                }
                catch (SocketException se)
                {
                    throw new Exception("Can't create sockets for communicating with VTOL Service", se);
                }

                try
                {
                    //Validate socket connection as shown:
                    //http://msdn.microsoft.com/en-us/library/ych8bz3x.aspx
                    VTOLSocket.Connect(VTOLEndPoint);
                }
                catch (SocketException e)
                {
                    throw new Exception("Error connecting VTOL Socket", e);
                }
            }
            else
            {
                throw new ArgumentNullException();
            }
        }
Exemple #2
0
        public void EntityPOSHostMessage1(IPEndPoint VTOLEndPoint, EntityHeaderVTOLListener HeaderVTOLListener, EntityPOSToHost POSToHost)
        {
            if ((POSToHost != null) || (HeaderVTOLListener != null) || (VTOLEndPoint != null))
            {
                this.HeaderVTOLListener = HeaderVTOLListener;
                this.POSToHost = POSToHost;
                this.VTOLEndPoint = VTOLEndPoint;

                try
                {
                    VTOLSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    VTOLSocket.SendTimeout = 10000;
                    VTOLSocket.ReceiveTimeout = 10000;

                }
                catch (SocketException se)
                {
                    throw new Exception("Can't create sockets for communicating with VTOL Service", se);
                }

                try
                {
                    //Validate socket connection as shown:
                    //http://msdn.microsoft.com/en-us/library/ych8bz3x.aspx
                    VTOLSocket.Connect(VTOLEndPoint);
                }
                catch (SocketException e)
                {
                    throw new Exception ("Error connecting VTOL Socket", e);
                }
            }
            else
            {
                throw new ArgumentNullException();
            }
        }