我正在尝试实现一个简单的ProxyServer来分析连接设备和外部世界之间的流量。
所以我认为它会是这样的:
//Accept incoming
ServerSocket serverSocket = new ServerSocket(8080);
Socket socket = serverSocket.accept();
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
//Log incoming requests
//Send to remote server on behalf of my device
Socket remote = new Socket(remoteHost, remotePort);
//forward the same data to remote client..
//wait for the reply
//send to my device
如何知道将请求转发到的远程端口/主机?
我错过了什么?
谢谢