internal Searcher(CAClient client)
 {
     Client         = client;
     m_searchThread = new Thread(SearchChannels)
     {
         IsBackground = true
     };
     m_searchThread.Start();
 }
Example #2
0
 internal Channel(CAClient client, string channelName)
 {
     ChannelName  = channelName;
     Status       = ChannelStatus.REQUESTED;
     Client       = client;
     MonitorMask  = MonitorMask.VALUE;
     HasValue     = false;
     SearchPacket = DataPacket.Create(
         16
         + ChannelName.Length
         + TypeHandling.Padding(ChannelName.Length)
         );
     SearchPacket.Command    = (ushort)CommandID.CA_PROTO_SEARCH;
     SearchPacket.DataType   = (ushort)CAConstants.DONT_REPLY;
     SearchPacket.DataCount  = (ushort)CAConstants.CA_MINOR_PROTOCOL_REVISION;
     SearchPacket.Parameter1 = cid;
     SearchPacket.Parameter2 = cid;
     SearchPacket.SetDataAsString(ChannelName);
 }
Example #3
0
 internal Channel(CAClient client, string channelName) :
     base(client, channelName)
 {
     MonitoredType = typeof(TType);
 }
        public void Init(CAClient client, IPEndPoint dest)
        {
            this.Client = client;
            this.m_destinationEndPoint = dest;
            m_socket = new Socket(
                AddressFamily.InterNetwork,
                SocketType.Stream,
                ProtocolType.Tcp
                );
            m_socket.SetSocketOption(
                SocketOptionLevel.Tcp,
                SocketOptionName.NoDelay,
                true
                );

            m_socket.Connect(dest);
            base.Start(m_socket);

            DataPacket p = DataPacket.Create(16);

            p.Command    = (ushort)CommandID.CA_PROTO_VERSION;
            p.DataType   = 1;
            p.DataCount  = (uint)CAConstants.CA_MINOR_PROTOCOL_REVISION;
            p.Parameter1 = 0;
            p.Parameter2 = 0;
            Send(p);

            p = DataPacket.Create(
                16
                + this.Client.Configuration.Hostname.Length
                + TypeHandling.Padding(
                    this.Client.Configuration.Hostname.Length
                    )
                );
            p.Command    = (ushort)CommandID.CA_PROTO_HOST_NAME;
            p.DataCount  = 0;
            p.DataType   = 0;
            p.Parameter1 = 0;
            p.Parameter2 = 0;
            p.SetDataAsString(
                this.Client.Configuration.Hostname
                );
            Send(p);

            p = DataPacket.Create(
                16
                + this.Client.Configuration.Username.Length
                + TypeHandling.Padding(
                    this.Client.Configuration.Username.Length
                    )
                );
            p.Command    = (ushort)CommandID.CA_PROTO_CLIENT_NAME;
            p.DataCount  = 0;
            p.DataType   = 0;
            p.Parameter1 = 0;
            p.Parameter2 = 0;
            p.SetDataAsString(
                this.Client.Configuration.Username
                );
            Send(p);
        }