Chapter 3. Socket Simulator - Options
SOCTEST - USER'S GUIDE

In this chapter, it describes about the options for socket.

SOL_SOCKET, IPPROTO_TCP, IPPROTO_UDP, and IPPROTO_IP options can be used.
Please refer the man page or internet public site for the details of each option.


SOL_SOCKET options

Option nameDescription
SO_DEBUGEnables recording of debugging information.
SO_ACCEPTCONNWhether the socket is listening.
SO_REUSEADDREnables local address reuse.
SO_KEEPALIVEEnables keep connections alive.
SO_DONTROUTEEnables routing bypass for outgoing messages.
SO_BROADCASTEnables permission to transmit broadcast messages.
SO_USELOOPBACKEnables communication by bypassing hardware.
SO_LINGERLinger on close if data present.
SO_OOBINLINEEnables reception of out-of-band data in band.
SO_REUSEPORTEnables bind the same port by multiple processes.
SO_TIMESTAMPEnables reciept of timestamp as a control message.
SO_TIMESTAMP_MONOTONICEnables reciept of monotonically increasing timestamp as a control message.
SO_SNDBUFBuffer size for output (bytes).
SO_RCVBUFBuffer size for input (bytes).
SO_SNDLOWATMinimum count for output (bytes).
SO_RCVLOWATMinimum count for input (bytes).
SO_SNDTIMEOTimeout value for output (seconds).
SO_RCVTIMEOTimeout value for input (seconds).
SO_ERRORGets and clears error on the socket (get only).
SO_TYPESocket type (get only).
  • SOCK_STREAM(1): Connection-based byte streams socket
  • SOCK_DGRAM(2): Connectionless datagrams socket
SO_NUMRCVPKTNumber of datagrams in receive socket buffer (get only).
SO_NET_SERVICE_TYPENetwork service type.
  • NET_SERVICE_TYPE_BE(0): Best effort
  • NET_SERVICE_TYPE_BK(1): Background system initiated
  • NET_SERVICE_TYPE_SIG(2): Signaling
  • NET_SERVICE_TYPE_VI(3): Interactive Video
  • NET_SERVICE_TYPE_VO(4): Interactive Voice
  • NET_SERVICE_TYPE_RV(5): Responsive Multimedia Audio/Video
  • NET_SERVICE_TYPE_AV(6): Multimedia Audio/Video Streaming
  • NET_SERVICE_TYPE_OAM(7): Operations, Administration, and Management
  • NET_SERVICE_TYPE_RD(8): Responsive Data
SO_NETSVC_MARKING_LEVELGet QoS marking in effect for socket (get only).
  • 0: The outgoing network interface is not known
  • 1: Default marking at layer 2 (for example Wi-Fi WMM)
  • 2: Layer 3 DSCP marking and layer 2 marking for all Network Service Types
  • 3: The system policy limits layer 3 DSCP marking and layer 2 marking to background Network Service Types


IPPROTO_TCP options

Option nameDescription
TCP_NODELAYSegments always sent asap (Disables Nagle algorithm).
TCP_MAXSEGMaximum segment size (bytes) for outgoing TCP packets.
TCP_NOOPTDisables TCP option.
TCP_NOPUSHDisables immediately sending data with PUSH bit.
TCP_KEEPALIVEIdle time (seconds) before keep-alive probes are sent.
Same as TCP_KEEPIDLE in Linux.
TCP_CONNECTIONTIMEOUTSets timeout (seconds) value for connection.
TCP_RXT_CONNDROPTIMETime (seconds) after which TCP retransmission will be stopped.
TCP_RXT_FINDROPDrops connection after retransmitting FIN 3 times.
TCP_KEEPINTVLTime (seconds) between individual keep-alive probes.
TCP_KEEPCNTMaximum number of keep-alive probes.
TCP_SENDMOREACKSSends a TCP acknowledgement for every data.
TCP_ENABLE_ECNUses explicit congestion notification (ECN).
TCP_FASTOPENRequests kernel to use TFO for the server socket.
TCP_CONNECTION_INFOGets TCP connection level statistics (get only).
TCP_NOTSENT_LOWATUnsent and unacknowledged data size (bytes) in send buffer.


IPPROTO_UDP options

Option nameDescription
UDP_NOCKSUMDon't checksum outbound payloads.


IPPROTO_IP options

Option nameDescription
IP_OPTIONSGets IP options on incoming IP packets.
If some option are exist, displays the contents in hex dump.

Sets / clears IP options on each outgoin IP packet.
Content of a option needs to be registed in Data Manager beforehand.
IP_HDRINCLSuppresses the kernel makes IP header.
IP_TOSSets the type-of-service field in IP header.
IP_TTLSets the time-to-live (hops) field in IP header.
IP_RECVOPTSEnables reciept of all IP options as a control message.
IP_RECVRETOPTSEnables reciept of IP options as a control message for response.
IP_RECVDSTADDREnables reciept of destination IP address as a control message.
IP_RETOPTSEnables sending / reciept of IP options (in_opts) as a control message.
IP_MULTICAST_IFSets the IP address of interface which multicast datagram is sent.
IP_MULTICAST_TTLChanges the TTL for outgoing multicast datagrams (range: 0 through 255).
IP_MULTICAST_LOOPEnables looped back by the IP layer for local delivery.
IP_ADD_MEMBERSHIPJoins a multicast group (set only).
IP_DROP_MEMBERSHIPDrops a multicast group membership (set only).
IP_PORTRANGESets the range of local port numbers.
  • IP_PORTRANGE_DEFAULT(0): default range, normally 1024 through 5000
  • IP_PORTRANGE_HIGH(1): high range, normally 49152 through 65535
  • IP_PORTRANGE_LOW(2): low range, normally from 1024 down to 1 in descending order (May be restricted to privileged processes on iOS kernel)
IP_RECVIFEnables reciept of interface which datagram is receibed.
IP_STRIPHDRDrops receive of raw IP header.
IP_RECVTTLEnables reciept of TTL as a control message.
IP_BOUND_IFGets / sets bound interface.
IP_PKTINFO
(IP_RECVPKTINFO)
Enables sending / reciept of pktinfo as a control message.
IP_RECVTOSEnables reciept of TOS as a control message.
IP_DONTFRAGDon't fragment packet.