Write sends raw RTCM data to the caster. In NTRIP v2 chunked mode each call is wrapped in a single HTTP chunk. The dump (if any) always receives the raw RTCM bytes, not the chunk framing, so captures remain valid RTCM3 streams.
(p []byte)
| 200 | // is wrapped in a single HTTP chunk. The dump (if any) always receives the raw |
| 201 | // RTCM bytes, not the chunk framing, so captures remain valid RTCM3 streams. |
| 202 | func (c *Client) Write(p []byte) (int, error) { |
| 203 | if c.conn == nil { |
| 204 | return 0, fmt.Errorf("not connected") |
| 205 | } |
| 206 | if c.dump != nil { |
| 207 | _, _ = c.dump.Write(p) |
| 208 | } |
| 209 | if c.config.Version == 2 && c.config.Chunked { |
| 210 | buf := make([]byte, 0, len(p)+16) |
| 211 | buf = append(buf, fmt.Sprintf("%X\r\n", len(p))...) |
| 212 | buf = append(buf, p...) |
| 213 | buf = append(buf, '\r', '\n') |
| 214 | if _, err := c.conn.Write(buf); err != nil { |
| 215 | return 0, err |
| 216 | } |
| 217 | return len(p), nil |
| 218 | } |
| 219 | return c.conn.Write(p) |
| 220 | } |
| 221 | |
| 222 | // dial establishes a TCP connection to the caster, optionally through a proxy. |
| 223 | func (c *Client) dial(ctx context.Context) (net.Conn, error) { |
no outgoing calls