Back: TCP.ServerSocket-initializing Up: TCP package Forward: TCP.Socket class-accessing   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

6.14 TCP.Socket

Defined in namespace TCP
Superclass: TCP.AbstractSocket
Category: Sockets-Streams

6.14.1 TCP.Socket class: accessing  (class)
6.14.2 TCP.Socket class: instance creation  (class)
6.14.3 TCP.Socket class: tests  (class)
6.14.4 TCP.Socket class: well known ports  (class)
6.14.5 TCP.Socket: accessing  (instance)
6.14.6 TCP.Socket: out-of-band data  (instance)
6.14.7 TCP.Socket: printing  (instance)
6.14.8 TCP.Socket: stream protocol  (instance)


6.14.1 TCP.Socket class: accessing

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

readBufferSize
Answer the size of the read buffer for newly-created sockets

readBufferSize: anInteger
Set the size of the read buffer for newly-created sockets

writeBufferSize
Answer the size of the write buffer for newly-created sockets

writeBufferSize: anInteger
Set the size of the write buffer for newly-created sockets


6.14.2 TCP.Socket class: instance creation

remote: ipAddressOrString port: remotePort
Create a new socket and connect to the given host (passed as a String to be resolved or as a SocketAddress), and to the given port.

remote: ipAddressOrString port: remotePort local: ipAddress port: localPort
Create a new socket and connect to the given host (passed as a String to be resolved or as a SocketAddress), and to the given remotePort. Then bind it to the local address passed in ipAddress, on the localPort port; if the former is nil, any local address will do, and if the latter is 0, any local port will do.


6.14.3 TCP.Socket class: tests

loopbackTest
Send data from one socket to another on the local machine. Tests most of the socket primitives.

loopbackTest: bufferSizes
Send data from one socket to another on the local machine. Tests most of the socket primitives. The parameter is the size of the input and output buffer sizes.

microTest
Extremely small test (try to receive SMTP header)

producerConsumerTest
Send data from one socket to another on the local machine. Tests most of the socket primitives and works with different processes.

sendTest
Send data to the 'discard' socket of localhost.

sendTest: host
Send data to the 'discard' socket of the given host. Tests the speed of one-way data transfers across the network to the given host. Note that many hosts do not run a discard server.

tweakedLoopbackTest
Send data from one socket to another on the local machine, trying to avoid buffering overhead. Tests most of the socket primitives. Comparison of the results of loopbackTest and tweakedLoopbackTest should give a measure of the overhead of buffering when sending/receiving large quantities of data.

udpLoopbackTest
Send data from one UDP socket to another on the local machine. Tests most of the socket primitives and works with different processes.


6.14.4 TCP.Socket 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'.

initialize
Initialize the receiver's defaults

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.14.5 TCP.Socket: accessing

address
Answer the address of the remote endpoint

port
Answer the port of the remote endpoint


6.14.6 TCP.Socket: out-of-band data

outOfBand
Return a datagram socket to be used for receiving out-of-band data on the receiver.


6.14.7 TCP.Socket: printing

printOn: aStream
Print a representation of the receiver on aStream


6.14.8 TCP.Socket: stream protocol

atEnd
Answer whether more data is available on the socket

bufferContents
Answer the current contents of the read buffer

canRead
Answer whether more data is available in the socket's read buffer or from the operating system.

canWrite
Answer whether more data is available in the socket's read buffer or from the operating system.

close
Flush and close the socket.

ensureWriteable
Answer whether more data is available in the socket's read buffer or from the operating system.

fill
Fill the read buffer with data read from the socket

flush
Flush the write buffer to the operating system

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

next
Read a byte from the socket. This might yield control to other Smalltalk Processes.

next: count
Read `count' bytes from the socket. This might yield control to other Smalltalk Processes.

next: n putAll: aCollection startingAt: pos
Write aString to the socket; this acts as a bit-bucket when the socket is closed. This might yield control to other Smalltalk Processes.

nextHunk
Answer the next buffers worth of stuff in the Stream represented by the receiver. Do at most one actual input operation.

nextPut: char
Write a character to the socket; this acts as a bit-bucket when the socket is closed. This might yield control to other Smalltalk Processes.

peek
Read a byte from the socket, without advancing the buffer; answer nil if no more data is available. This might yield control to other Smalltalk Processes.

peekFor: anObject
Read a byte from the socket, advancing the buffer only if it matches anObject; answer whether they did match or not. This might yield control to other Smalltalk Processes.

readBufferSize: size
Create a new read buffer of the given size (which is only possible before the first read or if the current buffer is empty).

writeBufferSize: size
Create a new write buffer of the given size, flushing the old one is needed. This might yield control to other Smalltalk Processes.



Back: TCP.Socket-printing Up: TCP.Socket Forward: TCP.SocketAddress   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on May, 22 2008 using texi2html