class_docstr: The ZMQ socket object
  
  To create a Socket, first create a Context::
  
      ctx = zmq.Context.instance()
  
  then call ``ctx.socket(socket_type)``::
  
      s = ctx.socket(zmq.ROUTER)
class_docstr_tok: ["The","ZMQ","socket","object","To","create","a","Socket",",","first","create","a","Context",":",":","ctx","=","zmq.Context.instance","(",")","then","call","``","ctx.socket","(","socket_type",")","``",":",":","s","=","ctx.socket","(","zmq.ROUTER",")"]
docstr: Set socket options with a unicode object.
  
  This is simply a wrapper for setsockopt to protect from encoding ambiguity.
  
  See the 0MQ documentation for details on specific options.
  
  Parameters
  ----------
  option : int
      The name of the option to set. Can be any of: SUBSCRIBE, 
      UNSUBSCRIBE, IDENTITY
  optval : unicode string (unicode on py2, str on py3)
      The value of the option to set.
  encoding : str
      The encoding to be used, default is utf8
docstr_tok: ["Set","socket","options","with","a","unicode","object",".","This","is","simply","a","wrapper","for","setsockopt","to","protect","from","encoding","ambiguity",".","See","the","0MQ","documentation","for","details","on","specific","options",".","Parameters","--","--","--","--","--","option",":","int","The","name","of","the","option","to","set",".","Can","be","any","of",":","SUBSCRIBE",",","UNSUBSCRIBE",",","IDENTITY","optval",":","unicode","string","(","unicode","on","py2",",","str","on","py3",")","The","value","of","the","option","to","set",".","encoding",":","str","The","encoding","to","be","used",",","default","is","utf8"]
code: def set_string(self, option, optval, encoding="utf-8"):
      """Set socket options with a unicode object.
  
      This is simply a wrapper for setsockopt to protect from encoding ambiguity.
  
      See the 0MQ documentation for details on specific options.
  
      Parameters
      ----------
      option : int
          The name of the option to set. Can be any of: SUBSCRIBE,
          UNSUBSCRIBE, IDENTITY
      optval : unicode string (unicode on py2, str on py3)
          The value of the option to set.
      encoding : str
          The encoding to be used, default is utf8
      """
      if not isinstance(optval, unicode):
          raise TypeError("unicode strings only")
      return self.set(option, optval.encode(encoding))
  
imports: import errno
  import random
  import sys
  import warnings
  import zmq
  from zmq.backend import Socket
  from .poll import Poller
  from .None import constants
  from .attrsettr import AttributeSetter
  from zmq.error import ZMQError, ZMQBindError
  from zmq.utils import jsonapi
  from zmq.utils.strtypes import bytes, unicode, basestring
  from .constants import SNDMORE, ENOTSUP, POLLIN, int64_sockopt_names, int_sockopt_names, bytes_sockopt_names, fd_sockopt_names
label_desc: Use image node_id 14 for calling the Socket obj's underlying member method code with example usage: obj.set_string(option, optval, encoding) and returns: self