func (client *StreamClient) Start() (*ClientResult, error) {
	if client.conn == nil {
		return nil, errors.New("Client must be connected first")
	}

	dataTransferSize := streamingTransferSize

	if client.options.NetworkProtocol == "udp" {
		dataTransferSize = stopWaitTransferSize
	}

	preambleMessage := preambleMessage{
		AckProtocol:      client.options.AckProtocol,
		DataTransferSize: dataTransferSize,
		PayloadSize:      client.options.MessageSize}

	preambleJSON, marshalErr := json.Marshal(preambleMessage)

	// The preamble is a JSON serialized preambleMessage followed by a EOT byte
	preambleBuffer := bytes.NewBuffer(preambleJSON)
	preambleBuffer.WriteByte(eot)

	if marshalErr != nil {
		return nil, marshalErr
	}

	conn := *client.conn

	_, txErr := conn.Write(preambleBuffer.Bytes())

	if txErr != nil {
		return nil, txErr
	}

	reader := bufio.NewReader(conn)

	preambleResponse, rxErr := reader.ReadByte()

	if rxErr != nil {
		return nil, rxErr
	}

	if uint8(preambleResponse) != ackMessage {
		return nil, errors.New("server did not acknowledge preamble")
	}

	return client.transfer()
}
// Start Begins a streamtest transfer
Start Begins a streamtest transfer
// Start Begins a streamtest transfer
func (client *StreamClient) Start() (*ClientResult, error) {
	if client.conn == nil {
		return nil, errors.New("Client must be connected first")
	}
	dataTransferSize := streamingTransferSize
	if client.options.NetworkProtocol == "udp" {
		dataTransferSize = stopWaitTransferSize
	}
	preambleMessage := preambleMessage{
		AckProtocol:      client.options.AckProtocol,
		DataTransferSize: dataTransferSize,
		PayloadSize:      client.options.MessageSize}
	preambleJSON, marshalErr := json.Marshal(preambleMessage)
	preambleBuffer := bytes.NewBuffer(preambleJSON)
	preambleBuffer.WriteByte(eot)
	if marshalErr != nil {
		return nil, marshalErr
	}
	conn := *client.conn
	_, txErr := conn.Write(preambleBuffer.Bytes())
	if txErr != nil {
		return nil, txErr
	}
	reader := bufio.NewReader(conn)
	preambleResponse, rxErr := reader.ReadByte()
	if rxErr != nil {
		return nil, rxErr
	}
	if uint8(preambleResponse) != ackMessage {
		return nil, errors.New("server did not acknowledge preamble")
	}
	return client.transfer()
}
func ( client * StreamClient ) Start ( ) ( * ClientResult , error ) { if client . conn == nil { return nil , errors . New ( " " ) } dataTransferSize := streamingTransferSize if client . options . NetworkProtocol == " " { dataTransferSize = stopWaitTransferSize } preambleMessage := preambleMessage { AckProtocol : client . options . AckProtocol , DataTransferSize : dataTransferSize , PayloadSize : client . options . MessageSize } preambleJSON , marshalErr := json . Marshal ( preambleMessage ) preambleBuffer := bytes . NewBuffer ( preambleJSON ) preambleBuffer . WriteByte ( eot ) if marshalErr != nil { return nil , marshalErr } conn := * client . conn _ , txErr := conn . Write ( preambleBuffer . Bytes ( ) ) if txErr != nil { return nil , txErr } reader := bufio . NewReader ( conn ) preambleResponse , rxErr := reader . ReadByte ( ) if rxErr != nil { return nil , rxErr } if uint8 ( preambleResponse ) != ackMessage { return nil , errors . New ( " " ) } return client . transfer ( ) }
Start Begins a streamtest transfer
Start Begins a streamtest transfer
// The preamble is a JSON serialized preambleMessage followed by a EOT byte