Managing sockets and their connections
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
To manage a socket and its connection, ABL allows you to:
-
Test if the socket is connected — If the
CONNECTED( )socket method isTRUE, the socket is connected. -
Control event sensitivity — At any time, you can make
the socket stop receiving
READ-RESPONSEevents by setting itsSENSITIVEattribute toFALSE. Also at any time, you can return it to receivingREAD-RESPONSEevents by settingSENSITIVEtoTRUE. -
Set socket options — ABL supports the following options:
TCP-NODELAYSO-LINGERSO-KEEPALIVESO-REUSEADDRSO-SNDBUFSO-RCVBUFSO-RCVTIMEO
To set and get these options, use the
SET-SOCKET-OPTION( )andGET-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-HOSTandREMOTE-PORTsocket attributes. Similarly, you can obtain the local host and port from theLOCAL-HOSTandLOCAL-PORTsocket 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 OBJECTstatement. However, you must disconnect the socket before you can delete it.CAUTION: Note that you should also delete theSELFhandle you used to read and write to the socket to avoid a memory leak.