Ejemplo n.º 1
0
 private void myOnConnectCallback(SocksProxySocket.Proxy p)
 {
     p.Send(raw);
     p.Receive();
 }
Ejemplo n.º 2
0
        private void myOnReceiveCallback(SocksProxySocket.Proxy p, byte[] data)
        {
            Close(false);

            if (onCompletionCallback == null)
                return;

            if (data != null)
            {
                onCompletionCallback(true, Encoding.ASCII.GetString(data));
            }
            else
            {
                onCompletionCallback(false, null);
            }
        }
    private void ChOnRecieve(SocksProxySocket.Proxy p, byte[] data)
    {
        string packetString = Encoding.ASCII.GetString(data);
        if (this.incompletePacketData != "")
        {
            packetString = this.incompletePacketData + packetString;
        }
        string[] packets = packetString.Split('\0');
        if (packets[packets.Length - 1] != "")
        {
            // we are still waiting for more data
            for (int i = 0; i < packets.Length - 1; i++)
            {
                ChHandlePacket(packets[i].Replace("\r\n", ""));
            }

            this.incompletePacketData = packets[packets.Length - 1];
            this.Receive();
        }
        else
        {
            // we are not waiting for more data
            this.incompletePacketData = "";
            for (int i = 0; i < packets.Length - 1; i++)
            {
                ChHandlePacket(packets[i].Replace("\r\n", ""));
            }
        }
    }