A TCP/IP socket to listen on the RSP port is created in
rsp_init ()
, and its file descriptor
stored in rsp.server_fd
. As a variant, if the
port is configured to be 0, the socket uses the port specified for
the or1ksim-rsp
service.
The setup uses standard POSIX calls to establish the socket and
associate it with a TCP/IP port. The interface is set to be
non-blocking and marked as a passive port (using a call to
listen ()
), with at most one outstanding
client request. There is no meaning to the server handling more than
one client GDB connection.
The main RSP handler function
handle_rsp ()
checks that the server port
is still open. This may be closed if there is a serious error. In
the present implementation, handle_rsp ()
gives up at this point, but a richer implementation could try
reopening a new server port.