Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Sockets : Read, writing, and managing sockets on clients and servers : Managing sockets and their connections
 
Managing sockets and their connections
To manage a socket and its connection, ABL allows you to:
*Test if the socket is connected — If the CONNECTED( ) socket method is TRUE, the socket is connected.
*Control event sensitivity — At any time, you can make the socket stop receiving READ-RESPONSE events by setting its SENSITIVE attribute to FALSE. Also at any time, you can return it to receiving READ-RESPONSE events by setting SENSITIVE to TRUE.
*Set socket options — ABL supports the following options:
*TCP-NODELAY
*SO-LINGER
*SO-KEEPALIVE
*SO-REUSEADDR
*SO-SNDBUF
*SO-RCVBUF
*SO-RCVTIMEO
To set and get these options, use the SET-SOCKET-OPTION( ) and GET-SOCKET-OPTION( ) methods.
*Obtain host and port values — You can obtain the remote host IP address and port number involved in the connection from the values of the REMOTE-HOST and REMOTE-PORT socket attributes. Similarly, you can obtain the local host and port from the LOCAL-HOST and LOCAL-PORT socket attributes.
*Disconnect a socket — You can close the socket and remove the association between the socket object and its remote port by invoking the DISCONNECT( ) socket method. ABL automatically closes the local socket when ABL detects that the corresponding remote socket in a connection is closed.
*Delete the socket object — You can delete a socket object using the DELETE OBJECT statement. However, you must disconnect the socket before you can delete it.
Caution: Note that you should also delete the SELF handle you used to read and write to the socket to avoid a memory leak.