0
我正試圖與2個PC仿真器進行通信。但之後我發現,這兩個仿真器具有相同的IP。我怎樣才能區分哪個IP是哪個模擬器?有沒有辦法設置不同的IP地址?我們如何更改Android仿真器的IP地址
我正試圖與2個PC仿真器進行通信。但之後我發現,這兩個仿真器具有相同的IP。我怎樣才能區分哪個IP是哪個模擬器?有沒有辦法設置不同的IP地址?我們如何更改Android仿真器的IP地址
見interconnecting emulator instances在Android開發者頁面
簡而言之:與很好的解釋您的回覆
To allow one emulator instance to communicate with another, you must set up the necessary network redirections as illustrated below.
Assume that your environment is
A is you development machine
B is your first emulator instance, running on A
C is your second emulator instance, running on A too
and you want to run a server on B, to which C will connect, here is how you could set it up:
Set up the server on B, listening to 10.0.2.15:<serverPort>
On B's console, set up a redirection from A:localhost:<localPort> to B:10.0.2.15:<serverPort>
On C, have the client connect to 10.0.2.2:<localPort>
For example, if you wanted to run an HTTP server, you can select <serverPort> as 80 and <localPort> as 8080:
B listens on 10.0.2.15:80
On B's console, issue redir add tcp:8080:80
C connects to 10.0.2.2:8080
感謝KevinDTimm。由於我是Android新手,你能說我該如何重定向IP。我正在這樣做.. – Suje
感謝KevinDTimm對你的回覆做出了很好的解釋。由於我是Android新手,你能說我怎樣才能使用「redir add tcp:5000:80 」重定向IP。我不知道我需要在哪裏運行這個命令。當我在控制檯中試用時,我得到了
Vdm重定向器已經加載。
我的代碼是這樣的..
– Suje
你說,在控制檯上,這是否意味着telnet localhost 5554?另外,80是否已經用於別的東西?最後,在原始問題中包含您的其他問題,他們更容易閱讀:) – KevinDTimm