ABL for programming sockets
- Last Updated: July 5, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
The following table lists the ABL elements that are either valid only for working with sockets or have special application in socket programming. The remaining sections explain how to use these elements.
| ABL element | Description |
|---|---|
|
An INTEGER attribute on the socket object handle that returns
the number of bytes read during the last invocation of the socket
READ( ) method. If the last READ( ) method call on the socket failed,
this attribute returns 0. |
|
An INTEGER attribute on the socket object handle that returns
the number of bytes written during the last invocation of the socket
WRITE( ) method. If the last
WRITE( ) method call on the socket
failed, this attribute returns 0. |
|
An event received on a server socket
object handle that indicates that a socket client is trying to connect.
This event, if handled by an input-blocking or PROCESS EVENTS statement, executes any CONNECT event handler defined for the
server socket object. You can use this event handler to obtain the
handle to the socket object with which the client is
communicating. |
|
A method on the socket object handle that connects a socket handle to a specified TCP/IP port on a specified host. |
|
A method on the socket object handle that indicates if a socket handle is currently connected to a port. |
|
A statement that creates a server socket
object with all attributes set to their default values, and stores its
handle in a HANDLE variable. |
|
A statement that creates a socket object
with all attributes set to their default values and stores its handle in
a HANDLE variable. |
|
A statement that defines the single
INPUT parameter to the CONNECT event procedure (specified using
the SET-CONNECT-PROCEDURE( ) method).
This parameter returns the handle to the socket object created when a
socket server receives a CONNECT event,
and which the socket server uses to communicate with the corresponding
socket client. |
|
A statement that you can use to delete a
handle, including socket and server socket object handles. To delete a
connected socket object, you must first disconnect it using the DISCONNECT( ) method. To delete a server
socket object enabled to listen for connections, you must first disable
it using the DISABLE-CONNECTIONS( )
method. |
|
A method on the server socket object handle that indicates that new connections are no longer accepted on the server socket. |
|
A method on the socket object handle that terminates the connection between the socket object and the port to which it is connected. |
|
A method on the server socket object
handle that specifies the TCP/IP port that ABL uses to listen for new
connections. Once called, ABL automatically listens for and accepts new
connections on the specified port.ENABLE-CONNECTIONS() also lets you specify the length of
the pending-connection queue. |
|
A HANDLE
attribute on the SESSION object handle
that returns the handle to the first entry in the chain of server socket
handles for the session. Note that you can have only one server socket
object in the list enabled to listen for events at one time. |
|
A HANDLE
attribute on the SESSION object handle
that returns the handle to the first entry in the chain of socket
handles for the session. |
|
A method on the socket object handle that indicates the number of bytes available for reading from the socket. |
|
A method on the socket object handle that
returns the specified TCP socket option. ABL supports the following options:
|
|
A HANDLE attribute on the SESSION object handle that returns the handle to the last
entry in the chain of server socket handles for the session. Note that
you can have only one server socket object in the list enabled to listen
for events at one time. |
|
A HANDLE attribute on the SESSION object handle that returns the handle to the last
entry in the chain of socket handles for the session. |
|
A CHARACTER attribute on the socket object handle that
returns the IP address on the local machine where the socket object is
connected. |
|
An INTEGER attribute on the socket object handle that returns
the local port number of the socket object. |
|
A HANDLE attribute on the socket and server socket object
handle that returns the next entry in the list of socket or server
socket handles created for the current OpenEdge session. |
|
The ABL data type used by the socket
handle READ( ) and WRITE( ) methods to read and write data on
a socket. A MEMPTR expression defines
a memory region whose size you must allocate in bytes. MEMPTR functions and statements allow you
to read and write data between most other ABL data types and the
specified memory region. For more information on the MEMPTR data type, see Introduction to External Program Interfaces. |
|
A HANDLE attribute on the socket and server socket object
handle that returns the previous entry in the list of socket or server
socket handles created for the current OpenEdge session. |
|
A statement that you can use to handle
any pending CONNECT or READ-RESPONSE events. You can also use any
input-blocking statement, such as the WAIT-FOR statement. |
|
A method on the socket object handle
that reads data from the specified socket. The method specifies the
MEMPTR memory region and byte
position within the region to store the data, a number of bytes to read
(and store) from the socket, and a read mode. The read mode indicates if
the exact specified number of bytes must be read or up to the specified
number of bytes can be read. |
|
An event received on a socket object
handle indicating that data is waiting on the socket to be read. This
event, if handled by an input-blocking or PROCESS EVENTS statement, executes any READ-RESPONSE event procedure or method
defined for the socket object. You can use this event procedure or
method if you want to read data from the socket in an event-driven
manner.1 |
|
A CHARACTER attribute on the socket object handle that
returns the IP address of the remote machine with which a connected
socket object is communicating. |
|
An INTEGER attribute on the socket object handle that returns
the number of the port on the remote machine with which a connected
socket object is communicating. |
|
A system handle that returns the handle
of the object on which an event is handled in the context of an event
procedure. In a CONNECT event
procedure, this is the handle to the server socket that is responding to
a CONNECT event. In a READ-RESPONSE event procedure, this is the
handle to the socket that is responding to a READ-RESPONSE event. |
|
A LOGICAL attribute on the socket and server socket object
handle that indicates whether the object can receive events. Set to
TRUE (receive events) by
default. |
|
A handle to a server socket object. This object allows you to listen for and accept TCP/IP connections on a given port. |
|
A method on the server socket object
handle that specifies the name of an internal procedure (CONNECT event procedure) to invoke when a
CONNECT event occurs. |
|
A method on the socket object handle that specifies
the name of the callback to invoke when a READ-RESPONSE event occurs. |
|
A method on the socket object handle
that specifies the name of an internal procedure (READ-RESPONSE event procedure) to invoke
when a READ-RESPONSE event
occurs. |
| Socket object handle | A handle to a socket object. This object allows you to read or write data on a TCP/IP socket and to perform other TCP/IP socket actions. |
|
A method on the socket object handle
that sets the specified TCP socket option. ABL supports the following options:
|
|
A CHARACTER attribute on the socket object handle that
returns the TLS server's X.500 Subject name field after any TLS session
has been established. |
|
A CHARACTER attribute on the socket and server socket object
handle that returns the handle type, which is SERVER-SOCKET for a server socket handle and SOCKET for a socket handle. |
|
A statement that you can use to handle
any pending CONNECT or READ-RESPONSE events. You can also use
PROCESS EVENTS or any other
input-blocking statement, such as the PROMPT-FOR statement, to handle the events. When a CONNECT or READ-RESPONSE event occurs in the context of these
statements, any CONNECT or READ-RESPONSE event procedure specified
for the corresponding handle is executed. |
|
A method on the socket object handle
that writes data to the specified socket. The method specifies the
MEMPTR memory region and byte
position within the region from which to write the data, as well as the
number of bytes to write from the region. |
1 A socket handle receives a
READ-RESPONSE event under the same
conditions that cause the TCP/IP select function to indicate that a
socket is ready to receive results. However, in ABL, you must read
data on the socket to continue to receive the event. For more
information, see Data detection using the event-driven model.