internal Channel(CAClient client, string channelName) { this.ChannelName = channelName; this.Status = ChannelStatus.REQUESTED; this.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); }
public void Init(CAClient client, IPEndPoint dest) { this.Client = client; this.destination = dest; socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true); socket.Connect(dest); base.Start(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); }