Here is a simple solution if you want to read all received data.
connbuf := bufio.NewReader(c.m_socket)
// Read the first byte and set the underlying buffer
b, _ := connbuf.ReadByte()
if connbuf.Buffered() > 0 {
var msgData []byte
msgData = append(msgData, b)
for connbuf.Buffered() > 0 {
// read byte by byte until the buffered data is not empty
b, err := connbuf.ReadByte()
if err == nil {
msgData = append(msgData, b)
} else {
log.Println("-------> unreadable caracter...", b)
}
}
// msgData now contain the buffered data...
}
``
Deal with sticky tcp/socket packet in Golang
Here is a simple solution if you want to read all received data.
Hello, This's a Golang web forum!
Bolt allows only one read-write transaction at a time, this site all CRUD are use transaction.