コード例 #1
0
        public static async Task <SocksProxyRequest> ReadRequestAsync(Stream s)
        {
            SocksProxyRequest request = new SocksProxyRequest();

            byte[] buffer = new byte[3];
            await s.ReadBytesAsync(buffer, 0, 3);

            request._version = buffer[0];
            request._command = (SocksProxyRequestCommand)buffer[1];
            request._dstEP   = await SocksProxyServer.ReadEndPointAsync(s);

            return(request);
        }
コード例 #2
0
        public static async Task <SocksProxyReply> ReadReplyAsync(Stream s)
        {
            SocksProxyReply reply = new SocksProxyReply();

            byte[] buffer = new byte[3];

            await s.ReadBytesAsync(buffer, 0, 3);

            reply._version = buffer[0];
            reply._reply   = (SocksProxyReplyCode)buffer[1];
            reply._bindEP  = await SocksProxyServer.ReadEndPointAsync(s);

            return(reply);
        }