//go:build windows package yu_tcp import ( yu_sys "gogs.qqck.cn/s/tools/sys" ) func (t *Tcp) init() { t.fd = yu_sys.INVALID_SOCKET } func (t *Tcp) connect(host string, port int) bool { t.close() t.fd = yu_sys.Socket_connect(host, port, t.sec, t.usec) return t.fd != yu_sys.INVALID_SOCKET } func (t *Tcp) send(fd uintptr, buf []byte) bool { return yu_sys.Socket_write_tcp(fd, buf, t.sec, t.usec) } func (t *Tcp) recv(fd uintptr, size int) []byte { return yu_sys.Socket_read_tcp(fd, size, t.sec, t.usec) } func (t *Tcp) close() *Tcp { if t.fd != yu_sys.INVALID_SOCKET { yu_sys.Closesocket.Call(t.fd) t.fd = yu_sys.INVALID_SOCKET } return t }