Exemple #1
0
func (c conn) SetWriteDeadline(t time.Time) (err error) {
	err = unix.SetsockoptTimeval(c.fd, unix.SOL_SOCKET, unix.SO_SNDTIMEO, getTimeval(t))
	if err != nil {
		err = Err{err}
	}
	return
}
Exemple #2
0
func (pc *packetSock) SetReadTimeout(t time.Duration) error {

	tv := unix.NsecToTimeval(t.Nanoseconds())
	return unix.SetsockoptTimeval(pc.fd, unix.SOL_SOCKET, unix.SO_RCVTIMEO, &tv)
}