ASPL Programming ver 1.00
© 2024 Bassem W. Jamaleddine


11-12

   MONITORING UNIX SOCKET STATUS

[MONITORING UNIX SOCKET STATUS]

WORKSPACE MONSOCKET DESCRIPTION:

This workspace shows how to monitor the state changes in the UNIX socket. This MONSOCKET workspace has the element grouping class SOCK. In this example a program is started with a socket listening on port 12345. Locate the process number of the program that opened the socket, eg. in here it is program whose process is 32036. The program process is treated as a group label, and the socket as an element of the group whose attributes are the socket attributes. We will create a variable sok12345, then we will interrogate the variable sok12345 seventeen times with a delay of one second. In the meantime on the system we start a client program to connect to opened socket of the process 32036. The client program writes to the opened socket. The changes in the state of the socket are being captured by ASPL in the variable sok12345. That is ASPL monitors the process number and update the ASPL variable sok12345.

①  aspl> sok12345 = ggpsok(pno,32036)

Start monitoring sok12345 by interrogating it:

②  aspl> ?17,1 sok12345
    (interrogate sok12345 17 times with 1 second delay)

In the meantime start a client to connet to socket 12345 and write to it.

③  aspl> v sorted
    (display ASPL symbol table)

④  aspl> ,fU sok12345 sok12345@1 sok12345@2 sok12345@3
    (display the changes in the socket element attributes)

This example is shown in the following terminal.

       terminal for example: MONITORING UNIX SOCKET STATUS
viewme

 -E- Display. 11.12.1   [MONITORING UNIX SOCKET STATUS][MONITORING UNIX SOCKET STATUS]
Terminal showing MONITORING UNIX SOCKET STATUS