func (d *DLConn) WriteMS(srcname string, start, end time.Time, data []byte) error {

	// sanity checks
	if !d.writable {
		return fmt.Errorf("connection is not writable")
	}
	if l := len(data); l != d.size {
		return fmt.Errorf("data has incorrect length, expected %d got %d", d.size, l)
	}

	/*
		// decode miniseed data
		var msr MSRecord
		if err := msr.Unpack(data, false); err != nil {
			return err
		}
	*/

	//TODO: The 'A' request an acknowledgement, currently because we always READ the connection we fail if this isn't in place
	//TODO: Do we need a way to write without an ack (performance or something?)
	dlp := Packet{
		Header: []byte(fmt.Sprintf("%s %s/MSEED %v %v A %v",
			cmdWrite, srcname,
			hpTime(start),
			hpTime(end),
			len(data)),
		),
		Body: data,
	}

	// send packet and wait for acknowledgement
	resp, err := d.sendPacket(dlp)
	if err != nil {
		return err
	}

	if s := resp.header(); !strings.HasPrefix(s, "OK") {
		return fmt.Errorf("non-OK response message: %v", s)
	}

	return nil
}
// WriteMS sends a raw miniseed packet to a datalink service, it will need to be decoded
// prior to sending to allow for the required message identification values to added.
WriteMS sends a raw miniseed packet to a datalink service, it will need to be decoded
prior to sending to allow for the required message identification values to added.
// WriteMS sends a raw miniseed packet to a datalink service it will need to be decoded // prior to sending to allow for the required message identification values to added .
func (d *DLConn) WriteMS(srcname string, start, end time.Time, data []byte) error {
	if !d.writable {
		return fmt.Errorf("connection is not writable")
	}
	if l := len(data); l != d.size {
		return fmt.Errorf("data has incorrect length, expected %d got %d", d.size, l)
	}
	dlp := Packet{
		Header: []byte(fmt.Sprintf("%s %s/MSEED %v %v A %v",
			cmdWrite, srcname,
			hpTime(start),
			hpTime(end),
			len(data)),
		),
		Body: data,
	}
	resp, err := d.sendPacket(dlp)
	if err != nil {
		return err
	}
	if s := resp.header(); !strings.HasPrefix(s, "OK") {
		return fmt.Errorf("non-OK response message: %v", s)
	}
	return nil
}
func ( d * DLConn ) WriteMS ( srcname string , start , end time . Time , data [ ] byte ) error { if ! d . writable { return fmt . Errorf ( " " ) } if l := len ( data ) ; l != d . size { return fmt . Errorf ( " " , d . size , l ) } dlp := Packet { Header : [ ] byte ( fmt . Sprintf ( " " , cmdWrite , srcname , hpTime ( start ) , hpTime ( end ) , len ( data ) ) , ) , Body : data , } resp , err := d . sendPacket ( dlp ) if err != nil { return err } if s := resp . header ( ) ; ! strings . HasPrefix ( s , " " ) { return fmt . Errorf ( " " , s ) } return nil }
WriteMS sends a raw miniseed packet to a datalink service, it will need to be decoded
prior to sending to allow for the required message identification values to added.
WriteMS sends a raw miniseed packet to a datalink service it will need to be decoded prior to sending to allow for the required message identification values to added .
// sanity checks /*
		// decode miniseed data
		var msr MSRecord
		if err := msr.Unpack(data, false); err != nil {
			return err
		}
	*/ //TODO: The 'A' request an acknowledgement, currently because we always READ the connection we fail if this isn't in place //TODO: Do we need a way to write without an ack (performance or something?) // send packet and wait for acknowledgement