Back: Sockets package Up: Sockets package Forward: Sockets.AbstractSocket class-defaults   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

6.1 Sockets.AbstractSocket

Defined in namespace Sockets
Superclass: Stream
Category: Sockets-Streams

This class models a client site socket. A socket is a TCP/IP endpoint for network communications conceptually similar to a file handle.

This class only takes care of buffering and blocking if requested. It uses an underlying socket implementation object which is a subclass of AbstractSocketImpl. This is necessary to hide some methods in FileDescriptor that are not relevant to sockets, as well as to implement buffering independently of the implementation nuances required by the different address families. The address family class (a subclass of SocketAddress) acts as a factory for socket implementation objects.

6.1.1 Sockets.AbstractSocket class: defaults  (class)
6.1.2 Sockets.AbstractSocket class: instance creation  (class)
6.1.3 Sockets.AbstractSocket class: timed-out operations  (class)
6.1.4 Sockets.AbstractSocket class: well known ports  (class)
6.1.5 Sockets.AbstractSocket: accessing  (instance)
6.1.6 Sockets.AbstractSocket: printing  (instance)
6.1.7 Sockets.AbstractSocket: socket options  (instance)
6.1.8 Sockets.AbstractSocket: stream protocol  (instance)
6.1.9 Sockets.AbstractSocket: testing  (instance)


6.1.1 Sockets.AbstractSocket class: defaults

defaultAddressClass
Answer the default address family to be used. In the library, the address family is represented by a subclass of SocketAddress which is by default IPAddress.

defaultAddressClass: class
Set the default address family to be used. In the library, the address family is represented by a subclass of SocketAddress which is by default IPAddress.

defaultImplementationClassFor: aSocketAddressClass
Answer the default implementation class. Depending on the subclass, this might be the default stream socket implementation class of the given address class, or rather its default datagram socket implementation class.


6.1.2 Sockets.AbstractSocket class: instance creation

new
This method should not be called for instances of this class.

new: implementation
Answer a new instance of the receiver, using as the underlying layer the object passed as the `implementation' parameter; the object is probably going to be some kind of AbstractSocketImpl.

new: implClass addressClass: addressClass
Answer a new instance of the receiver, using as the underlying layer a new instance of `implementationClass' and using the protocol family of `addressClass'.


6.1.3 Sockets.AbstractSocket class: timed-out operations

checkPeriod
Answer the period that is to elapse between socket polls if data data is not ready and the connection is still open (in milliseconds)

checkPeriod: anInteger
Set the period that is to elapse between socket polls if data data is not ready and the connection is still open (in milliseconds)

timeout
Answer the period that is to elapse between the request for (yet unavailable) data and the moment when the connection is considered dead (in milliseconds)

timeout: anInteger
Set the period that is to elapse between the request for (yet unavailable) data and the moment when the connection is considered dead (in milliseconds)


6.1.4 Sockets.AbstractSocket class: well known ports

defaultPortAt: protocol
Answer the port that is used (by default) for the given service (high level protocol)

defaultPortAt: protocol ifAbsent: port
Answer the port that is used (by default) for the given service (high level protocol), or the specified port if none is registered.

defaultPortAt: protocol put: port
Associate the given port to the service specified by `protocol'.

portCmdServer
Answer the port on which the rsh daemon listens

portDNS
Answer the port on which the DNS listens

portDayTime
Answer the port on which the TOD service listens

portDiscard
Answer the port on which the DISCARD service listens

portEcho
Answer the port on which the ECHO service listens

portExecServer
Answer the port on which the exec server listens

portFTP
Answer the port on which the FTP daemon listens

portFinger
Answer the port on which the finger daemon listens

portGopher
Answer the port on which the Gopher daemon listens

portHTTP
Answer the port on which the http daemon listens

portLoginServer
Answer the port on which the rlogin daemon listens

portNNTP
Answer the port on which the nntp daemon listens

portNetStat
Answer the port on which the NETSTAT service listens

portPOP3
Answer the port on which the pop3 daemon listens

portReserved
Answer the last port reserved to privileged processes

portSMTP
Answer the port on which the SMTP daemon listens

portSSH
Answer the port on which the SSH daemon listens

portSystat
Answer the port on which the SYSTAT service listens

portTelnet
Answer the port on which the TELNET daemon listens

portTimeServer
Answer the port on which the time server listens

portWhois
Answer the port on which the WHOIS daemon listens


6.1.5 Sockets.AbstractSocket: accessing

address
Answer an IP address that is of common interest (this can be either the local or the remote address, according to the definition in the subclass).

available
Answer whether there is data available on the socket. Same as #canRead, present for backwards compatibility.

canRead
Answer whether there is data available on the socket.

canWrite
Answer whether there is free space in the socket's write buffer.

close
Close the socket represented by the receiver.

flush
Flush any buffers used by the receiver.

isOpen
Answer whether the connection between the receiver and the remote endpoint is still alive.

isPeerAlive
Answer whether the connection with the peer remote machine is still valid.

localAddress
Answer the local IP address of the socket.

localPort
Answer the local IP port of the socket.

port
Answer an IP port that is of common interest (this can be the port for either the local or remote endpoint, according to the definitions in the subclass

remoteAddress
Answer the IP address of the socket's remote endpoint.

remotePort
Answer the IP port of the socket's remote endpoint.


6.1.6 Sockets.AbstractSocket: printing

printOn: aStream
Print a representation of the receiver on aStream


6.1.7 Sockets.AbstractSocket: socket options

soLinger
Answer the number of seconds that the socket is allowed to wait if it promises reliable delivery but has unacknowledged/untransmitted packets when it is closed, or nil if those packets are left to their destiny or discarded.

soLinger: linger
Set the number of seconds that the socket is allowed to wait if it promises reliable delivery but has unacknowledged/untransmitted packets when it is closed.

soLingerOff
Specify that, even if the socket promises reliable delivery, any packets that are unacknowledged/untransmitted when it is closed are to be left to their destiny or discarded.

species
Answer `String'.


6.1.8 Sockets.AbstractSocket: stream protocol

atEnd
By default, answer whether the connection is still open.

next
Read another character from the socket, failing if the connection is dead.

next: n putAll: aCollection startingAt: pos
Write `char' to the socket, failing if the connection is dead. The SIGPIPE signal is automatically caught and ignored by the system.

nextPut: char
Write `char' to the socket, failing if the connection is dead. The SIGPIPE signal is automatically caught and ignored by the system.


6.1.9 Sockets.AbstractSocket: testing

isExternalStream
Answer whether the receiver streams on a file or socket.



Back: Sockets.AbstractSocket-stream protocol Up: Sockets.AbstractSocket Forward: Sockets.AbstractSocketImpl   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on February, 22 2012 using texi2html