Chapter 4. Socket Simulator - I/O
SOCTEST - USER'S GUIDE

In this chapter, it describes about the I/O function via socket.

To send or receive data, sets the following information to the parameters of system call.
With executing after selecting predetermined parameter, system call is called.


Address

When using sendto(2) or sendmsg(2), specifies the destination address.
Regists the address in Address Manager beforehand. See Chapter 6. Address Manager for details.

When using recvfrom(2) or recvmsg(2), specifies whether gets remote address.


Message buffer

Specifies data content and data size if sending data, buffer size if receiving data.
The maximum size is limited to 64 KB in order to prevent an increase in packet charges due to erroneous operation.

Selects data content from the followings. When using a customized data, regists in Data Manager beforehand. See Chapter 7. Data Manager for details.

Data contentDetails
Customized dataUser can customize freely.
All "0" ascii string00000000...
Continuous numeric ascii string01234567890123456789...
Random numeric ascii stringRandom of 0-9
Random alphabet & numeric
ascii string
Random of 0-9a-zA-Z
Random printable ascii stringRandom of 0-9a-zA-Z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
All 0 binary code0x00 0x00 0x00 0x00 ...
All 1 binary code0xff 0xff 0xff 0xff ...
Random binary codeRandom of 0x00-0xff

Originally, if using sendmsg (2) and recvmsg (2) can be specified multiple data or buffer. [Note]
Originally, sendmsg(2) or recvmsg(2) can be specified multiple data / buffers.
However, in the current version, you can only specify a single data and buffer in this app.


Control messages

When using sendmsg(2), sends control messages as an ancillary data.
When using recvmsg(2), specifies the buffer size for an ancillary data.

Level
Type
DescriptionSendRecv
SOL_SOCKET
SCM_RIGHTS
Sends / receives the list of file descriptors (32 bit integer) via UNIX domain socket.
SOL_SOCKET
SCM_TIMESTAMP
Receives timestamp (timeval structure).
SOL_SOCKET
SCM_CREDS
Sends / receives process credential information (cmsgcred structure data) via UNIX domain socket.
SOL_SOCKET
SCM_TIMESTAMP_MONOTONIC
Receives monotonically increasing timestamp.
IPPROTO_IP
IP_RECVOPTS
Receives all IP options.
IPPROTO_IP
IP_RECVRETOPTS
Receives IP options for response.
IPPROTO_IP
IP_RECVDSTADDR
Receives destination IP address.
IPPROTO_IP
IP_RETOPTS
Gets / sets IP options (ip_opts structure data).
IPPROTO_IP
IP_RECVIF
Receives interface information (sockaddr_dl structure data) which datagram is receibed.
IPPROTO_IP
IP_RECVTTL
Receives TTL (8 bit integer).
IPPROTO_IP
IP_PKTINFO
Gets pktinfo (ip_pktinfo structure data) on recv socket / Sets source on sent datagram.
IPPROTO_IP
IP_RECVTOS
Receives TOS (8 bit integer).



Message flags

Specifies the I/O behavior with flags.
Specifies with the logical sum of 0 or more flags.
Please refer the man page or internet public site for the detail of each flags.

FlagDescriptionSendRecvMsg
MSG_OOBSends OOB (out-of-band) data. / Requests receipt of OOB data. / Indicates receipt of OOB data.
MSG_DONTROUTESends to hosts only on directly connected networks.
MSG_PEEKRequests to return data without removing data from receive queue.
MSG_WAITALLRequests that operation block until receiving full data.
MSG_TRUNCIndicates that the trailing part of data was discarded because data was larger than buffer.
MSG_CTRUNCIndicates that some control data were discarded because ancillary data buffer was lack.