public CAServerChannel(CAServer cAServer, int serverId, int clientId, string channelName, CATcpConnection tcpConnection)
 {
     // TODO: Complete member initialization
     this.Server            = cAServer;
     this.ServerId          = serverId;
     this.ClientId          = clientId;
     this.ChannelName       = channelName;
     this.TcpConnection     = tcpConnection;
     tcpConnection.Closing += new EventHandler(tcpConnection_Closing);
     Property = "VAL";
     if (channelName.Contains("."))
     {
         string[] splitted = channelName.Split('.');
         Record   = Server.records[splitted[0]];
         Property = splitted[1].ToUpper();
     }
     else
     {
         Record = Server.records[ChannelName];
     }
     if (!Record.CanBeRemotlySet)
     {
         Access = AccessRights.ReadOnly;
     }
     TcpConnection.Send(Server.Filter.ChannelCreatedMessage(ClientId, ServerId, FindType(Record[Property].GetType()), Record.dataCount, Access));
 }
Example #2
0
        public CABeacon(CAServer server, int udpPort, int beaconPort)
        {
            this.udpPort = 5064;
            endPoint     = new IPEndPoint(IPAddress.Broadcast, beaconPort);
            if (server.ServerAddress == IPAddress.Any)
            {
                serverIps.AddRange(Dns.GetHostAddresses(Dns.GetHostName()).Where(row => !row.IsIPv6LinkLocal && !row.IsIPv6Multicast && !row.IsIPv6SiteLocal && row.AddressFamily == AddressFamily.InterNetwork));
            }
            else
            {
                serverIps.Add(server.ServerAddress);
            }

            runningThread = new Thread(new ThreadStart(Do));
            runningThread.IsBackground = true;
            runningThread.Start();
        }
        internal CATcpConnection(Socket socket, CAServer server)
        {
            pipe = new Pipe();

            Socket = socket;

            processData = new Thread(new ThreadStart(BackgroundProcess));
            processData.IsBackground = true;
            processData.Start();

            Server    = server;
            remoteKey = Socket.RemoteEndPoint.ToString();
            Socket.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, ReceiveData, null);

            // Send version
            Socket.Send(new byte[] { 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0 });

            Closed = false;
        }
 internal CAServerFilter(CAServer server)
 {
     this.Server = server;
 }