Home > Language Reference > Classes

StreamSocket Class

  + Object
    + Stream
      + StreamSocket

Description

The StreamSocket class encapsulates all the necessary methods for communication on a TCP/IP network. This class is instantiable but not derivable or cloneable (see also Data Streams).

Once a StreamSocket object is instantiated, the connection to a remote machine is achieved using the Connect method. This method uses the settings in the "Connection" and "Network" tabs in the configuration panel to establish the remote connection and then opens a socket on the specified host. If necessary, the network configuration of the device can be modified prior to opening the connection, using the Connection and Network objects.

Reading and writing in the stream is done like in any other stream, by using the Read and Write methods. The Ready method determines if the data is ready to be read or written. Typically, this method is used in conjunction with a timer to poll at regular intervals.

At any moment, including before calling the Connect method, you can modify the value of the Timeout property to define the delay after which the object raises an error if the requested read/write operation does not succeed.

Finally, you must close the socket by calling the Disconnect method once it is no longer needed.

If you are running on Palm OS 5.0 or later, the StreamSocket object supports SSL. For more information, please refer to the Connect method and to the SslContext class.

The MiniBrowser sample shows a thorough example of use of this class.

Members

MembersDescription
Connect Opens a TCP/IP network connection.
Disconnect Closes a connection.
GetHostByAddr Looks up a host name given its IP address.
GetHostByName Looks up a host IP address given its host name.
PeerName Returns the local and remote socket names.
Ready Tests whether the input or output buffer contains data.
SocketRef Returns the socket descriptor.
SslContext Returns the SslContext object used to open the connection.
Timeout Delay before raising an error.
Inherited from StreamDescription
Position Stream pointer position.
Read Reads data from a stream.
Seek Moves the stream pointer.
SeekToBegin Moves the pointer to the beginning of the stream.
SeekToEnd Moves the pointer to the end of the stream.
Size Total size of the data in a stream.
Write Writes data to a stream.
Inherited from ObjectDescription
ClassID Returns the type identifier corresponding to the actual class of the object.
Implements Determines whether the object implements the features of a given class.
Iterate Event raised to iterate over the elements of a container object.
Recipient Recipient of events sent by the object.
Serialize Event raised to serialize the object content into a stream.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0N/A