func (sc *SimpleClient) Flush() error {
	return sc.writer.Flush()
}
Flush writes all buffered data to the underlying TCP connection
package client
import (
	"bufio"
	"encoding/binary"
	"fmt"
	"io"
	"mraft/store"
	"net"
	"sync"
	"time"
)
const defaultBufferSize = 5 * 1024
type SimpleClient struct {
	mu      *sync.Mutex
	message chan *store.RaftAttribute
	conn    net.Conn
	reader  *bufio.Reader
	writer  *bufio.Writer
	recv chan struct{}
}
func NewSimpleClient(address string, recv chan struct{}) (*SimpleClient, error) {
	conn, err := net.Dial("tcp", address)
	if err != nil {
		return nil, err
	}
	sc := &SimpleClient{
		mu:      &sync.Mutex{},
		message: make(chan *store.RaftAttribute, 1000),
		conn:    conn,
		writer:  bufio.NewWriterSize(conn, defaultBufferSize),
		reader:  bufio.NewReaderSize(conn, defaultBufferSize),
		recv: recv,
	}
	go sc.handleSend()
	go sc.handleRecv()
	return sc, nil
}