Chapter 2. Socket Simulator - Functions
SOCTEST - USER'S GUIDE

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

With tapping a socket row in Top View, it transitions to the view listed the system calls.
Executes the selected system call in the list.


getsockopt / setsockopt

Gets / sets a socket option. See Chapter 3. Socket Simulator - Options.


bind

Binds a address to the socket.
Selects an assigning address in address list of the next view. Regists the address in Address Manager beforehand. See Chapter 6. Address Manager for details.


connect

Connects the socket to specifying address.
Selects a connecting address in address list of the next view. Regists the address in Address Manager beforehand. See Chapter 6. Address Manager for details.

If the socket is SOCK_STREAM type and non-blocking mode, connect(2) returns with EINPROGRESS. In this case, this app can monitor the completion connect. See Chapter 8. Menu for details.

[Note]
This app does not provide the function to interrupt connect(2) by signal.
Therefore, when connect processing is not completed immediately (mainly not reachable to remote host), needs to wait for timeout.


listen

Enables a server as a listening socket, and waits for connections.
Arriving connection requests are queued. Specifies the length, backlog, of this queue in the next view.

[Caution]
Note that kernel would accept an access from an unspecified number of hosts when using a socket which to bound the ANY address (0.0.0.0).
In this case, the kernel will be able to accept backlog's connections and receive the RCVBUF size of data even if you don't call accept(2) or recv(2).

[Note]
In iOS, SO_ACCEPTFILTER option can not be used. And, the kernel's firewall feature (packet filter or ipfw) can't be used on non jailbroken iOS device.
Therefore, it isn't realizable the control (blocking access from a specific host) equivalent to a firewall.


accept

Creates new connected socket with taking a connection request out from queue.
In the next view, specifies whether gets remote address.

[Note]
This app does not provide the function to interrupt accept(2) by signal.
Therefore, when the queue is empty (no connection request arrived), you become not be able to operate until arriving connection request newly.
In this case, please restart the app.


send

sendto

sendmsg

sendfile

send for Bulk Data Transfer

recv

recvfrom

recvmsg

recv for Bulk Data Transfer

Sends and receives data via socket. See Chapter 4. Socket Simulator - I/O.


getsockname

Gets the current address associated with the socket.
This address is reflected in Top View. See Chapter 1. Socket Simulator for details.

This app can automatically find out address and reflect to Top View when connecting. See Chapter 8. Menu for details.


getpeername

Gets the remote address connecting a socket.
This address is reflected in Top View. See Chapter 1. Socket Simulator for details.


shutdown

Shuts down one or both halves of the connection.
In the next view, selects how to shut down the connection.
Status of full duplex connection is reflected in Top View. See Chapter 1. Socket Simulator for details.


fcntl(F_GETFL / F_SETFL)

Confirms the current I/O mode of a socket with F_GETFL command. And, changes the I/O mode with F_SETFL command.
If O_NONBLOCK is set to file status flags, it indicats that the socket is in non-blocking mode.
Current I/O mode is reflected in Top View. See Chapter 1. Socket Simulator for details.


poll

Waits (polling) for the socket to be ready to send or receive.
In this polling, selects timeout value (mili seconds) in the next view, and selects requests events (0 or more events from POLLIN, POLLPRI, and POLLOUT) in futher next view. Please refer the man page or internet public site for the function of each event.

When poll(2) returns, returned events are displayed as polling result.

[Note]
This app does not provide the function to interrupt poll(2) by signal.
Therefore, if you select No timeout (blocks indefinitely until any event), becomes not be able to operate this app when no events.
In this case, please restart the app.