public DeviceConnection(Device device)
        {
            this.device  = device;
            deviceCalls  = DeviceCalls.getInstance();
            ws2Functions = Ws2Functions.getInstance();

            portConnections = new Dictionary <short, PortConnection>();
        }
Beispiel #2
0
        public PortConnection(short port, Device device)
        {
            this.port   = port;
            this.device = device;

            deviceCalls  = DeviceCalls.getInstance();
            ws2Functions = Ws2Functions.getInstance();

            activeSockets        = new List <Socket>();
            autoResetEventSocket = new AutoResetEvent(false);
        }
Beispiel #3
0
        public static bool checkPort(Ws2Functions ws2Functions, DeviceCalls deviceCalls, Device device, short port)
        {
            int outHandle = -1;
            int errorCode = initHandle(deviceCalls, device, port, ref outHandle);

            if (errorCode == 0)
            {
                ws2Functions.closeSocket(outHandle);
                return(true);
            }
            return(false);
        }
Beispiel #4
0
 public static Ws2Functions getInstance()
 {
     if (instance == null)
     {
         lock (syncRoot)
         {
             if (instance == null)
             {
                 Ws2Functions ws2 = new Ws2Functions();
                 ws2.initDll();
                 instance = ws2;
             }
         }
     }
     return(instance);
 }