IRISLIB database
ServerSocket Class Reference
Inheritance diagram for ServerSocket:
Collaboration diagram for ServerSocket:

Public Member Functions

_.Library.Boolean Close (_.Library.Status pSC)
 Disconnect the current connection and close the Socket for listening. More...
 
 Disconnect (_.Library.Status pSC, _.Library.Boolean pIntentional, _.Library.Status pSCReason)
 Disconnect the current connection but keep the socket open for listening.
 
_.Library.Boolean Listen (_.Library.Numeric pTimeout, _.Library.Status pSC)
 Until pTimeout, wait for an inbound TCP connection to be received on the port specified in the prior Open() call. More...
 
_.Library.Integer ListenJob (_.Library.Numeric pTimeout, _.Library.String pOnConnectedClass, _.Library.String pJobArgs, _.Library.String pSocketClass, _.Library.Integer pMaxJobs, _.Library.Boolean pDummy, _.Library.Status pSC)
 Until pTimeout, listen for incoming connections and spawn a job for each one, up to pMaxJobs. More...
 
_.Library.Boolean Open (_.Library.String pPort, _.Library.Numeric pTimeout, _.Library.Status pSC)
 Open the socket for listening on the port given by pPort, waiting up to pTimeout for the port to be available to listen on.
 
- Public Member Functions inherited from DeviceStream
_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. More...
 
 Attach (_.Library.String pDevice, _.Library.Status pSC)
 Attach to the named open Device or to the current Device by default.
 
 Flush (_.Library.Status pSC)
 Ensure that any data already written to the stream buffer are actually sent to the stream.
 
_.Library.String Read (_.Library.Integer pMaxReadLen, _.Library.Numeric pTimeout, _.Library.Status pSC)
 Read until pMaxReadLen chars are gotten or pTimeout expires. More...
 
_.Library.String ReadLine (_.Library.Integer pMaxReadLen, _.Library.Numeric pTimeout, _.Library.Status pSC, _.Library.String pLineTerminator)
 Read until pMaxReadLen chars are gotten, pTimeout expires, or a LineTerminator character is found. More...
 
 Write (_.Library.String pData, _.Library.Boolean pFlush, _.Library.Status pSC)
 Write pData to the stream buffer. More...
 
- Public Member Functions inherited from Stream
_.Library.Integer CopyFrom (_.IO.I.Stream pSource, _.Library.Numeric pTimeout, _.Library.Boolean pFlush, _.Library.Status pSC)
 Copy all available data from pSource to the current stream buffer. More...
 
_.Library.Integer CopyReplace (_.IO.I.Stream pDest, _.Library.Integer pMaxReadLen, _.Library.Numeric pTimeout, _.Library.Numeric pIdleTimeout, _.Library.String pPrevBuf, _.Library.Boolean pFlush, _.Library.Boolean pInsensitive, _.Library.String pRewind, _.Library.Status pSC, pSearchReplace)
 Replace from the current stream the strings contained in a list of alternating search and replace target string arguments. More...
 
_.Library.Integer CopyReplaceArray (_.IO.I.Stream pDest, _.Library.Integer pMaxReadLen, _.Library.Numeric pTimeout, _.Library.Numeric pIdleTimeout, _.Library.String pPrevBuf, _.Library.Boolean pFlush, _.Library.Boolean pInsensitive, _.Library.String pRewind, _.Library.Status pSC, pSearchReplace)
 Replace from the current stream the strings contained in an array of alternating search and replace target string values called pSearchReplace. More...
 
_.Library.Integer OutputToDevice (_.Library.Integer pLength, _.Library.Numeric pTimeout, _.Library.Status pSC)
 Copy all available data from the current stream to the current system device.
 
_.Library.String ReadUntil (_.Library.Integer pMaxReadLen, _.Library.Numeric pTimeout, _.Library.Numeric pIdleTimeout, _.Library.String pPrevBuf, _.Library.Boolean pInsensitive, _.Library.Integer pWhich, _.Library.Status pSC, pTarget)
 Read until one of the Target strings is found or a timeout occurs. More...
 
_.Library.String ReadUntilArray (_.Library.Integer pMaxReadLen, _.Library.Numeric pTimeout, _.Library.Numeric pIdleTimeout, _.Library.String pPrevBuf, _.Library.Boolean pInsensitive, _.Library.Integer pWhich, _.Library.Status pSC, pTargets)
 Read until one of the Target strings is found or a timeout occurs. More...
 
- Public Member Functions inherited from RegisteredObject
_.Library.Status OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount)
 This callback method is invoked when the current object is added to the SaveSet,. More...
 
_.Library.Status OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned)
 This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More...
 
_.Library.Status OnNew ()
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
_.Library.Status OnValidateObject ()
 This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More...
 
- Public Member Functions inherited from CharacterIO
_.Library.Boolean IsCharacterGet ()
 (This property is overridden from IO.I.Stream but has a different meaning in this context of character IO.)
 
- Public Member Functions inherited from LineIO
 WriteLine (_.Library.String pLine, _.Library.Boolean pFlush, _.Library.Status pSC)
 Write pLine to the stream buffer, followed by the current LineTerminator characters. More...
 
- Public Member Functions inherited from TranslationDevice
_.Library.Status SetCharEncodingTable (_.Library.String pCharEncoding, _.Library.String pCharEncodingAlias)
 Set translation table based on character encoding.
 
- Public Member Functions inherited from SocketCommon
 Flush (_.Library.Status pSC)
 Ensure that any data already written to the TCP buffer are actually sent to the remote partner.
 
_.Library.String Read (_.Library.Integer pMaxReadLen, _.Library.Numeric pTimeout, _.Library.Status pSC)
 Read until pMaxReadLen chars are gotten or pTimeout expires. More...
 
_.Library.String ReadAny (_.Library.Integer pMaxReadLen, _.Library.Numeric pTimeout, _.Library.Status pSC)
 Return as soon as any data arrives, or timeout expires, or MaxReadLen is reached.
 
_.Library.String ReadLine (_.Library.Integer pMaxReadLen, pTimeout, _.Library.Status pSC, _.Library.String pLineTerminator)
 Read until pMaxReadLen chars are gotten, pTimeout expires, or a LineTerminator character is encountered. More...
 
 Write (_.Library.String pData, _.Library.Boolean pFlush, _.Library.Status pSC)
 Write pLine to the stream buffer, followed by the current LineTerminator characters. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from DeviceStream
_.IO.DeviceStream AttachNew (_.Library.String pDevice, _.Library.Status pSC)
 Attach the current $IO device to an instance of this class.
 
- Static Public Member Functions inherited from SocketCommon
_.Library.Status GetLocalInterfaces (pResults)
 Get a list of link-local interface addresses. More...
 
- Public Attributes inherited from Stream
 AtEnd
   More...
 
 DefaultFlushOnWrite
 InputStream interface. More...
 
 IsCharacter
   More...
 
 IsOpen
   More...
 
 Name
   More...
 
- Public Attributes inherited from ByteIO
 CharEncoding
 Info-only description of the character encoding that this byte stream represents, if it. More...
 
- Public Attributes inherited from CharacterIO
 CharEncoding
 Names the character encoding used to encode this character stream in its storage or transport format. More...
 
- Public Attributes inherited from LineIO
 LineTerminator
 A string of characters that will be written at the end of each WriteLine operation, and any of which will terminate a ReadLine() operation if it is encountered. More...
 
- Public Attributes inherited from TranslationDevice
 IsSingleByte
 Does the TranslationTable currently in effect represent a single-byte encoding. More...
 
 TranslationTable
 The name of the TranslationTable in effect for the Stream's device. More...
 
- Public Attributes inherited from ServerSocketIO
 AllowedClientIPAddresses
 A comma-separated list of remote IP addresses to accept connections from optional. More...
 
 ConnectionQueueSize
 Number of connections that can queue up waiting for this server socket to attend to them. More...
 
 IsConnected
 Is there a connection open from a remote client. More...
 
- Public Attributes inherited from SocketCommon
 AtEnd
 Override InitialExpression. More...
 
 DisconnectHandler
 Object on which to call OnDisconnect() when a connection is lost. More...
 
 InputBufferSize
   More...
 
 KeepAliveInterval
 Connection-specific TCP keepalive interval in seconds. More...
 
 LineTerminator
 Override InitialExpression. More...
 
 LocalInterface
 In a multi-homed system, specify which local network interface the TCP connection should go through. More...
 
 OutputBufferSize
   More...
 
 Port
   More...
 
 Remote
 The IP address and port of the remote end of the socket connection. More...
 
 SSLConfig
 The name of an existing SSL/TLS system configuration set to use (Secure Socket Layer / Transport Layer Security, configured via the system portal's Security Management page). More...
 
 TCPReceiveBuffer
 Control the size, in bytes, of the TCP Receive Buffer (SO_RCVBUF) for the TCP device. More...
 
 TCPSendBuffer
 Control the size, in bytes, of the TCP Send Buffer (SO_SNDBUF) for the TCP device. More...
 
- Static Public Attributes inherited from RegisteredObject
 CAPTION = None
 Optional name used by the Form Wizard for a class when generating forms. More...
 
 JAVATYPE = None
 The Java type to be used when exported.
 
 PROPERTYVALIDATION = None
 This parameter controls the default validation behavior for the object. More...
 

Member Function Documentation

◆ Close()

Disconnect the current connection and close the Socket for listening.

Any connections the OS may have accepted

for the current port and queued for us will be disconnected as well.

Reimplemented from DeviceStream.

◆ Listen()

_.Library.Boolean Listen ( _.Library.Numeric  pTimeout,
_.Library.Status  pSC 
)

Until pTimeout, wait for an inbound TCP connection to be received on the port specified in the prior Open() call.

Note that the OS may accept up to ConnectionQueueSize connections for the port on your behalf before you call this method. If the OS has queued one or more accepted connections, this method will return immediately with one of them connected.

Reimplemented from ServerSocketIO.

◆ ListenJob()

_.Library.Integer ListenJob ( _.Library.Numeric  pTimeout,
_.Library.String  pOnConnectedClass,
_.Library.String  pJobArgs,
_.Library.String  pSocketClass,
_.Library.Integer  pMaxJobs,
_.Library.Boolean  pDummy,
_.Library.Status  pSC 
)

Until pTimeout, listen for incoming connections and spawn a job for each one, up to pMaxJobs.

If pMaxJobs

threshold has already been reached, wait for an existing connected job to quit and then spawn a job for the new connection. When the timeout expires, this method will return but any spawned jobs will continue running until they terminate on their own. pOnConnectedClass is the classname of a customer defined class that must contain a classmethod called OnConnected(). ListenJob() will arrange for this classmethod to be called each time a new connection arrives. It will call OnConnected() with 2 arguments, a IO.ServerSocket instance representing the connected socket, and a string that was passed in to ListenJob() in the pJobArgs argument. This allows the OnConnected() method to engage in TCP communications over the socket from within a fresh job created for the purpose. The pSocketClass argument to ListenJob() allows you to specify a subclass of IO.ServerSocket should be instantiated in the connection jobs. This could implement additional methods for handling common protocol elements expected to be exchanged across the TCP connection. Normally you will just use IO.ServerSocket and its Read() and Write() methods. The pDummy argument is ignored.

Reimplemented from ServerSocketIO.