public async Task WriteToAsync(Stream s) { byte[] buffer = new byte[3]; buffer[0] = _version; buffer[1] = (byte)_command; await s.WriteAsync(buffer, 0, 3); await SocksProxyServer.WriteEndPointAsync(_dstEP, s); }
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); }
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); }