1

我有 ip 和端口,但我不知道挂载点的名称。我怎样才能得到它?

然后我想连接到服务器:

GET /mountpoint HTTP/1.1
Host: some.ntrip.caster
Ntrip-Version: Ntrip/2.0
User-Agent: NTRIP client X/1.0
Connection: close

所以,我需要知道挂载点名称......

4

1 回答 1

0
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包含挂载点表

于 2020-02-28T08:22:21.217 回答