// ZMQ_RCVHWM: Set high water mark for inbound messages
//
// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc28
965398
func (soc *Socket) SetRcvhwm(value int) error {
	return soc.setInt(C.ZMQ_RCVHWM, value)
}
892413
func (whisper *Whisper) SetMaxMessageSize(size uint32) error {
	if size > MaxMessageSize {
		return fmt.Errorf("message size too large [%d>%d]", size, MaxMessageSize)
	}
	whisper.settings.Store(maxMsgSizeIdx, size)
	return nil
}
698355
func (msg *Message) SetStreamID(streamID MessageStreamID) {
	msg.prevStreamID = msg.streamID
	msg.streamID = streamID
}
458736
func (soc *Socket) SetRcvbuf(value int) error {
	return soc.setInt(C.ZMQ_RCVBUF, value)
}
1244717
func (s *Connector) SetVmManagerName(v string) *Connector {
	s.VmManagerName = &v
	return s
}
26657
func (p *packetConn) SetPromiscuous(b bool) error {
	mreq := unix.PacketMreq{
		Ifindex: int32(p.ifi.Index),
		Type:    unix.PACKET_MR_PROMISC,
	}

	membership := unix.PACKET_ADD_MEMBERSHIP
	if !b {
		membership = unix.PACKET_DROP_MEMBERSHIP
	}

	return p.s.SetSockoptPacketMreq(unix.SOL_PACKET, membership, &mreq)
}
1149459
func (ep *endpoint) saveRcvBufSizeMax() int {
	max := ep.rcvBufSizeMax
	// Make sure no new packets will be handled regardless of the lock.
	ep.rcvBufSizeMax = 0
	// Release the lock acquired in beforeSave() so regular endpoint closing
	// logic can proceed after save.
	ep.rcvMu.Unlock()
	return max
}
31573
func (soc *Socket) SetRcvbuf(value uint64) error {
	return soc.setUInt64(C.ZMQ_RCVBUF, value)
}
980363
func SetMaxMsgsz(n int) error {
	if initVersionError != nil {
		return initVersionError
	}
	if initContextError != nil {
		return initContextError
	}
	return defaultCtx.SetMaxMsgsz(n)
}
1286384
func (soc *Socket) SetAffinity(value uint64) error {
	return soc.setUInt64(C.ZMQ_AFFINITY, value)
}
820627
func (soc *Socket) SetXpubVerbose(value int) error {
	return soc.setInt(C.ZMQ_XPUB_VERBOSE, value)
}
329243
func (soc *Socket) SetHwm(value uint64) error {
	return soc.setUInt64(C.ZMQ_HWM, value)
}
195923
func server_thread() {
	file, err := os.Open("testdata")
	if err != nil {
		panic(err)
	}

	router, _ := zmq.NewSocket(zmq.ROUTER)
	//  Default HWM is 1000, which will drop messages here
	//  since we send more than 1,000 chunks of test data,
	//  so set an infinite HWM as a simple, stupid solution:
	router.SetRcvhwm(0)
	router.SetSndhwm(0)
	router.Bind("tcp://*:6000")
	for {
		//  First frame in each message is the sender identity
		identity, err := router.Recv(0)
		if err != nil {
			break //  Shutting down, quit
		}

		//  Second frame is "fetch" command
		command, _ := router.Recv(0)
		if command != "fetch" {
			panic("command != \"fetch\"")
		}

		chunk := make([]byte, CHUNK_SIZE)
		for {
			n, _ := io.ReadFull(file, chunk)
			router.SendMessage(identity, chunk[:n])
			if n == 0 {
				break //  Always end with a zero-size frame
			}
		}
	}
	file.Close()
}
687507
func (s *H264Settings) SetQvbrQualityLevel(v int64) *H264Settings {
	s.QvbrQualityLevel = &v
	return s
}
885886
func (soc *Socket) SetUseFd(value int) error {
	if minor < 2 {
		return ErrorNotImplemented42
	}
	return soc.setInt(C.ZMQ_USE_FD, value)
}
1127133
func (api *PublicWhisperAPI) SetMaxMessageSize(ctx context.Context, size uint32) (bool, error) {
	return true, api.w.SetMaxMessageSize(size)
}
176127
func (a *AdafruitMotorHatDriver) setPWM(conn Connection, pin byte, on, off int32) (err error) {
	// register and values to be written to that register
	regVals := make(map[int][]byte)
	regVals[0] = []byte{byte(_LedZeroOnL + 4*pin), byte(on & 0xff)}
	regVals[1] = []byte{byte(_LedZeroOnH + 4*pin), byte(on >> 8)}
	regVals[2] = []byte{byte(_LedZeroOffL + 4*pin), byte(off & 0xff)}
	regVals[3] = []byte{byte(_LedZeroOffH + 4*pin), byte(off >> 8)}
	for i := 0; i < len(regVals); i++ {
		if _, err = conn.Write(regVals[i]); err != nil {
			return
		}
	}
	return
}