MCPcopy Create free account
hub / github.com/facebook/time / Write

Method Write

ntrip/client.go:202–220  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
202func (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.
223func (c *Client) dial(ctx context.Context) (net.Conn, error) {

Callers 15

TestClientWriteChunkedFunction · 0.95
TestClientCloseFunction · 0.95
dialViaProxyMethod · 0.45
sourceHandshakeMethod · 0.45
postHandshakeMethod · 0.45
LogMethod · 0.45

Calls

no outgoing calls