Skip to content

Reading serial ERROR_OPERATION_ABORTED (995) #131

Description

@hww

Reading bytes from the serial unexpected terminated with the error

error(syscall.Errno) golang.org/x/sys/windows.ERROR_OPERATION_ABORTED (995)

Sample code

The sample code below

serialMode := &serial.Config{Name: "COM4", Baud: baudRate, Size: 8, Parity: serial.ParityNone, StopBits: 1}
port, err := serial.OpenPort(serialMode)
for { 
	reader := bufio.NewReader(port)
	reply, err := reader.ReadBytes('\x0a')
	if err != nil {
		panic(err)
	}
	fmt.Println(reply)
}

Other info

Platform: Windows 10
Golang: go version go1.21.3 windows/amd64
Serial interface: USB to Serial

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions