我有ip和port,但是我不知道挂载点的名称。我如何得到它?
然后我要连接到服务器:
GET /mountpoint HTTP/1.1
Host: some.ntrip.caster
Ntrip-Version: Ntrip/2.0
User-Agent: NTRIP client X/1.0
Connection: close
所以,我需要知道挂载点名称...
最佳答案
val socketAddress = InetSocketAddress(ip, port)
socket.connect(socketAddress, 10 * 1000)
...
if (socket.isConnected) {
val request = ("GET / HTTP/1.1\r\n" +
"User-Agent: NTRIP Client/1.0\r\n" +
"Connection: close\r\n" +
"\r\n").toByteArray()
socket.getOutputStream().write(request)
val response = String(socket.getInputStream().readBytes())
变量
response
包含安装点表