]> Top TCP.AbstractSocket TCP.AbstractSocket Defined in namespace TCPSuperclass: StreamCategory: Sockets-Streams TCP.AbstractSocket class: defaults defaultAddressClassdefaultAddressClass Answer the default address family to be used. In the library,the address family is represented by a subclass of SocketAddresswhich is by default IPAddress. defaultAddressClass: defaultAddressClass: class Set the default address family to be used. In the library,the address family is represented by a subclass of SocketAddresswhich is by default IPAddress. defaultImplementationClass defaultImplementationClass Answer the default implementation class. Depending on thesubclass, this might be the default stream socket implementationclass of the default address class, or rather its default datagramsocket implementation class TCP.AbstractSocket class: instance creation newnew This method should not be called for instances of this class. new: new: implementation Answer a new instance of the receiver, using as the underlyinglayer the object passed as the `implementation' parameter; theobject is probably going to be some kind of AbstractSocketImpl. TCP.AbstractSocket class: timed-out operations checkPeriodcheckPeriod Answer the period that is to elapse between socket polls if datadata is not ready and the connection is still open (in milliseconds) checkPeriod: checkPeriod: anInteger Set the period that is to elapse between socket polls if datadata is not ready and the connection is still open (in milliseconds) timeout timeout Answer the period that is to elapse between the request for (yetunavailable) data and the moment when the connection is considered dead(in milliseconds) timeout: timeout: anInteger Set the period that is to elapse between the request for (yetunavailable) data and the moment when the connection is considereddead (in milliseconds) TCP.AbstractSocket: accessing addressaddress Answer an IP address that is of common interest (this can be eitherthe local or the remote address, according to the definition in thesubclass). available available Answer whether there is data available on the socket. close close Close the socket represented by the receiver. flush flush Flush any buffers used by the receiver. isOpen isOpen Answer whether the connection between the receiver and the remoteendpoint is still alive. localAddress localAddress Answer the local IP address of the socket. localPort localPort Answer the local IP port of the socket. port port Answer an IP port that is of common interest (this can be the port foreither the local or remote endpoint, according to the definitions in thesubclass remoteAddress remoteAddress Answer the IP address of the socket's remote endpoint. remotePort remotePort Answer the IP port of the socket's remote endpoint. TCP.AbstractSocket: printing printOn:printOn: aStream Print a representation of the receiver on aStream TCP.AbstractSocket: socket options soLingersoLinger Answer the number of seconds that the socket is allowed to waitif it promises reliable delivery but has unacknowledged/untransmittedpackets when it is closed, or nil if those packets are left to theirdestiny or discarded. soLinger: soLinger: linger Set the number of seconds that the socket is allowed to waitif it promises reliable delivery but has unacknowledged/untransmittedpackets when it is closed. soLingerOff soLingerOff Specify that, even if the socket promises reliable delivery, anypackets that are unacknowledged/untransmitted when it is closedare to be left to their destiny or discarded. species species Answer `String'. TCP.AbstractSocket: stream protocol atEndatEnd By default, answer whether the connection is still open. next next Read another character from the socket, failing if the connection isdead. nextPut: nextPut: char Write `char' to the socket, failing if the connection is dead. TheSIGPIPE signal is automatically caught and ignored by the system. TCP.AbstractSocket: testing isExternalStreamisExternalStream Answer whether the receiver streams on a file or socket. TCP.AbstractSocketImpl TCP.AbstractSocketImpl Defined in namespace TCPSuperclass: FileDescriptorCategory: Sockets-Protocols TCP.AbstractSocketImpl class: abstract addressClassaddressClass Answer the class responsible for handling addresses forthe receiver protocol protocol Answer the protocol parameter for `create' socketType socketType Answer the socket type parameter for `create'. TCP.AbstractSocketImpl class: C call-outs accept:peer:addrLen:accept: socket peer: peer addrLen: len Not commented. bind:to:addrLen: bind: socket to: addr addrLen: len Not commented. connect:to:addrLen: connect: socket to: addr addrLen: len Not commented. create:type:protocol: create: family type: type protocol: protocol Not commented. getPeerName:addr:addrLen: getPeerName: socket addr: addr addrLen: len Not commented. getSockName:addr:addrLen: getSockName: socket addr: addr addrLen: len Not commented. listen:log: listen: socket log: len Not commented. option:level:at:get:size: option: socket level: level at: name get: value size: len Not commented. option:level:at:put:size: option: socket level: level at: name put: value size: len Not commented. receive:buffer:size:flags:from:size: receive: socket buffer: buf size: len flags: flags from: addr size: addrLen Not commented. send:buffer:size:flags:to:size: send: socket buffer: buf size: len flags: flags to: addr size: addrLen Not commented. TCP.AbstractSocketImpl class: C constants sockDgramsockDgram Not commented. sockRaw sockRaw Not commented. sockRDM sockRDM Not commented. sockStream sockStream Not commented. soError soError Not commented. soLinger soLinger Not commented. solSocket solSocket Not commented. soReuseAddr soReuseAddr Not commented. TCP.AbstractSocketImpl class: socket creation newnew Create a socket for the receiver. TCP.AbstractSocketImpl: accessing connectTo:port:connectTo: ipAddress port: port Connect the receiver to the given IP address and port. `Connecting'means attaching the remote endpoint of the socket. localAddress localAddress Answer the address of the local endpoint of the socket (even if IPis not being used, this identifies the machine that is bound to thesocket). localPort localPort Answer the port of the local endpoint of the socket (even if IPis not being used, this identifies the service or process thatis bound to the socket). remoteAddress remoteAddress Answer the address of the remote endpoint of the socket (even if IPis not being used, this identifies the machine to which the socketis connected). remotePort remotePort Answer the port of the remote endpoint of the socket (even if IPis not being used, this identifies the service or process to whichthe socket is connected). TCP.AbstractSocketImpl: asynchronous operations ensureReadableensureReadable If the file is open, wait until data can be read from it. The waitallows other Processes to run. ensureWriteable ensureWriteable If the file is open, wait until we can write to it. The waitallows other Processes to run. waitForException waitForException If the file is open, wait until an exceptional condition (suchas presence of out of band data) has occurred on it. The waitallows other Processes to run. TCP.AbstractSocketImpl: C call-outs accept:peer:addrLen:accept: socket peer: peer addrLen: len Not commented. bind:to:addrLen: bind: socket to: addr addrLen: len Not commented. connect:to:addrLen: connect: socket to: addr addrLen: len Not commented. create:type:protocol: create: family type: type protocol: protocol Not commented. getPeerName:addr:addrLen: getPeerName: socket addr: addr addrLen: len Not commented. getSockName:addr:addrLen: getSockName: socket addr: addr addrLen: len Not commented. listen:log: listen: socket log: len Not commented. option:level:at:get:size: option: socket level: level at: name get: value size: len Not commented. option:level:at:put:size: option: socket level: level at: name put: value size: len Not commented. receive:buffer:size:flags:from:size: receive: socket buffer: buf size: len flags: flags from: addr size: addrLen Not commented. send:buffer:size:flags:to:size: send: socket buffer: buf size: len flags: flags to: addr size: addrLen Not commented. TCP.AbstractSocketImpl: socket operations accept:accept: implementationClass Accept a connection on the receiver, and create a new instanceof implementationClass that will deal with the newly createdactive server socket. addressClass addressClass Answer the class responsible for handling addresses forthe receiver bindTo:port: bindTo: ipAddress port: port Bind the receiver to the given IP address and port. `Binding' meansattaching the local endpoint of the socket. fileOp: fileOp: ioFuncIndex Private - Used to limit the number of primitives used by FileStreams fileOp:ifFail: fileOp: ioFuncIndex ifFail: aBlock Private - Used to limit the number of primitives used by FileStreams. fileOp:with: fileOp: ioFuncIndex with: arg1 Private - Used to limit the number of primitives used by FileStreams fileOp:with:ifFail: fileOp: ioFuncIndex with: arg1 ifFail: aBlock Private - Used to limit the number of primitives used by FileStreams. fileOp:with:with: fileOp: ioFuncIndex with: arg1 with: arg2 Private - Used to limit the number of primitives used by FileStreams fileOp:with:with:ifFail: fileOp: ioFuncIndex with: arg1 with: arg2 ifFail: aBlock Private - Used to limit the number of primitives used by FileStreams. fileOp:with:with:with: fileOp: ioFuncIndex with: arg1 with: arg2 with: arg3 Private - Used to limit the number of primitives used by FileStreams fileOp:with:with:with:ifFail: fileOp: ioFuncIndex with: arg1 with: arg2 with: arg3 ifFail: aBlock Private - Used to limit the number of primitives used by FileStreams. getSockName getSockName Retrieve a ByteArray containing a sockaddr_in struct for thelocal endpoint of the socket. listen: listen: backlog Make the receiver a passive server socket with a pending connectionsqueue of the given size. TCP.AbstractSocketImpl: socket options optionAt:level:put:optionAt: opt level: level put: anObject Modify the value of a socket option. The option identifier is in`opt' and the level is in `level'. anObject can be a boolean,integer, socket address or ByteArray. A layer over this method isprovided for the most common socket options, so this will be rarelyused. optionAt:level:size: optionAt: opt level: level size: size Answer in a ByteArray of the given size the value of a socket option.The option identifier is in `opt' and the level is in `level'. Alayer over this method is provided for the most common socket options,so this will be rarely used. soError soError Answer the pending error on the socket, or 0 if none soLinger soLinger Answer the number of seconds by which a `close' operation can blockto ensure that all the packets have reliably reached the destination,or nil if those packets are left to their destiny. soLinger: soLinger: linger Set the number of seconds by which a `close' operation can blockto ensure that all the packets have reliably reached the destination.If linger is nil, those packets are left to their destiny. soReuseAddr soReuseAddr Answer whether another socket can be bound the same local address as thisone. If you enable this option, you can actually have two sockets with thesame Internet port number; but the system won't allow you to use the twoidentically-named sockets in a way that would confuse the Internet. Thereason for this option is that some higher-level Internet protocols,including FTP, require you to keep reusing the same socket number. soReuseAddr: soReuseAddr: aBoolean Set whether another socket can be bound the same local address as this one. TCP.Datagram TCP.Datagram Defined in namespace TCPSuperclass: ObjectCategory: Sockets-Protocols TCP.Datagram class: instance creation data:data: aByteArray Answer a new datagram with the specified data. data:address:port: data: aByteArray address: ipAddress port: port Answer a new datagram with the specified target socket, andaByteArray as its data. object:address:port: object:objectDumper:address:port: object: object address: ipAddress port: port Serialize the object onto a ByteArray, and create a Datagramwith the object as its contents, and the specified receiver.Note that each invocation of this method creates a separateObjectDumper; if different objects that you're sending are likelyto contain references to the same objects, you should use#object:objectDumper:address:port:. object:objectDumper:address:port: object: object objectDumper: od address: ipAddress port: port Serialize the object onto a ByteArray, and create a Datagram withthe object as its contents, and the specified receiver. Serializationtakes place through ObjectDumper passed as `od', and the streamattached to the ObjectDumper is resetted every time. Using thismethod is indicated if different objects that you're sending arelikely to contain references to the same objects. TCP.Datagram: accessing addressaddress Answer the address of the target socket address: address: ipAddress Set the address of the target socket data data Answer the data attached to the datagram data: data: aByteArray Set the data attached to the datagram get object:address:port: get Parse the data attached to the datagram through a newly createdObjectDumper, and answer the resulting object. This method iscomplementary to #object:address:port:. getThrough: object:objectDumper:address:port: getThrough: objectDumper Parse the data attached to the datagram through the givenObjectDumper without touching the stream to which it isattached, and answer the resulting object. The state ofthe ObjectDumper, though, is updated. This method iscomplementary to #object:objectDumper:address:port:. port port Answer the IP port of the target socket port: port: thePort Set the IP port of the target socket TCP.DatagramSocket TCP.DatagramSocket Defined in namespace TCPSuperclass: TCP.AbstractSocketCategory: Sockets-Streams TCP.DatagramSocket class: accessing defaultBufferSizedefaultBufferSize Answer the default maximum size for input datagrams. defaultBufferSize: defaultBufferSize: size Set the default maximum size for input datagrams. defaultImplementationClass defaultImplementationClass Answer the default implementation class. Depending on thesubclass, this might be the default stream socket implementationclass of the default address class, or rather its default datagramsocket implementation class TCP.DatagramSocket class: initialization initializeinitialize Initialize the class to use an input datagram size of 128. TCP.DatagramSocket class: instance creation local:port:local: ipAddressOrString port: remotePort Create a new socket and bind it to the given host (passed as aString to be resolved or as an IPAddress), on the given port. new new Answer a new datagram socket (by default an UDP socket), withouta specified local address and port. port: port: localPort Create a new socket and bind it to the local host on the given port. remote:port:local:port: remote: ipAddressOrString port: remotePort local: ipAddress port: localPort Create a new socket and bind it to the given host (passed as aString to be resolved or as an IPAddress), and to the given remotePort.The default destination for the datagrams will be ipAddressOrString(if not nil), on the remotePort port. TCP.DatagramSocket: accessing addressaddress Answer the local address. bufferSize bufferSize Answer the size of the buffer in which datagrams are stored. bufferSize: bufferSize: size Set the size of the buffer in which datagrams are stored. next next Read a datagram on the socket and answer it. nextPut: nextPut: aDatagram Send the given datagram on the socket. peek peek Peek for a datagram on the socket and answer it. peek: peek: datagram Peek for a datagram on the socket, store it in `datagram', andanswer the datagram itself. port port Answer the local port. receive: receive: datagram Read a datagram from the socket, store it in `datagram', andanswer the datagram itself. TCP.DatagramSocket: direct operations nextFrom:port:nextFrom: ipAddress port: port Answer the next datagram from the given address and port. TCP.DatagramSocketImpl TCP.DatagramSocketImpl Defined in namespace TCPSuperclass: TCP.AbstractSocketImplCategory: Sockets-Protocols TCP.DatagramSocketImpl class: parameters socketTypesocketType Answer the socket type parameter for `create'. TCP.DatagramSocketImpl: accessing bufferSizebufferSize Answer the size of the buffer in which datagrams are stored. bufferSize: bufferSize: size Set the size of the buffer in which datagrams are stored. TCP.DatagramSocketImpl: C constants ipAddMembershipipAddMembership Not commented. ipDropMembership ipDropMembership Not commented. ipMulticastIf ipMulticastIf Not commented. ipMulticastTtl ipMulticastTtl Not commented. msgPeek msgPeek Not commented. TCP.DatagramSocketImpl: socket operations nextnext Retrieve a datagram from the receiver, answer a new Datagram object nextPut: nextPut: aDatagram Send aDatagram on the socket peek peek Peek for a datagram on the receiver, answer a new Datagram object peek: peek: aDatagram Peek for a datagram on the receiver, answer aDatagram modifiedto contain information on the newly received datagram. receive: receive: aDatagram Retrieve a datagram from the receiver, answer aDatagram modifiedto contain information on the newly received datagram. receive:datagram: receive: flags datagram: aDatagram Receive a new datagram into `datagram', with the given flags, andanswer `datagram' itself; this is an abstract method.The flags can be zero to receive the datagram, or `self msgPeek'to only peek for it without removing it from the queue. send:to:port: send: aDatagram to: theReceiver port: port Send aDatagram on the socket to the given receiver and port TCP.ICMPSocketImpl TCP.ICMPSocketImpl Defined in namespace TCPSuperclass: TCP.RawSocketImplCategory: Sockets-Protocols TCP.ICMPSocketImpl class: C constants protocolprotocol Not commented. TCP.ICMPSocketImpl class: implementation addressClassaddressClass Answer the class that holds network addresses for ICMP sockets,i.e. IPAddress. TCP.IPAddress TCP.IPAddress Defined in namespace TCPSuperclass: TCP.SocketAddressCategory: Sockets-Protocols TCP.IPAddress class: C call-outs primAnyLocalAddress:in:primAnyLocalAddress: hostName in: byteArray Not commented. TCP.IPAddress class: C constants addressFamilyaddressFamily Not commented. protocolFamily protocolFamily Not commented. TCP.IPAddress class: constants addressSizeaddressSize Answer the size of an IPv4 address. version version Answer the version of IP that the receiver implements. TCP.IPAddress class: initialization createLocalAddresscreateLocalAddress Answer an object representing a local address in the addressfamily for the receiver createLoopbackHost createLoopbackHost Answer an object representing the loopback host in the addressfamily for the receiver. This is 127.0.0.1 for IPv4. createUnknownAddress createUnknownAddress Answer an object representing an unkown address in the addressfamily for the receiver initialize initialize Set up the default implementation classes for the receiver TCP.IPAddress class: instance creation fromArray:fromArray: parts Answer a new IPAddress from an array of numbers; the numbersare to be thought as the dot-separated numbers in the standardnumbers-and-dots notation for IPv4 addresses. fromBytes: [131 fromBytes: aByteArray Answer a new IPAddress from a ByteArray containing the bytesin the same order as the digit form: 131.175.6.2 would berepresented as #[131 175 6 2]. fromSockAddr:port: fromSockAddr: aByteArray port: portAdaptor Private - Answer a new IPAddress from a ByteArray containing aC sockaddr_in structure. The portAdaptor's value is changedto contain the port that the structure refers to. fromString: loopbackHost fromString: aString Answer a new IPAddress from a String containing the requestedaddress in digit form. Hexadecimal forms are not allowed.An Internet host address is a number containing four bytes of data.These are divided into two parts, a network number and a localnetwork address number within that network. The network numberconsists of the first one, two or three bytes; the rest of thebytes are the local address.Network numbers are registered with the Network Information Center(NIC), and are divided into three classes–A, B, and C. The localnetwork address numbers of individual machines are registered withthe administrator of the particular network.Class A networks have single-byte numbers in the range 0 to 127. Thereare only a small number of Class A networks, but they can each supporta very large number of hosts (several millions). Medium-sized Class Bnetworks have two-byte network numbers, with the first byte in the range128 to 191; they support several thousands of host, but are almostexhausted. Class C networks are the smallest and the most commonlyavailable; they have three-byte network numbers, with the first bytein the range 192-223. Class D (multicast, 224.0.0.0 to 239.255.255.255)and E (research, 240.0.0.0 to 255.255.255.255) also have three-bytenetwork numbers.Thus, the first 1, 2, or 3 bytes of an Internet address specifies anetwork. The remaining bytes of the Internet address specify the addresswithin that network. The Class A network 0 is reserved for broadcast toall networks. In addition, the host number 0 within each network isreserved for broadcast to all hosts in that network. The Class A network127 is reserved for loopback; you can always use the Internet address`127.0.0.1' to refer to the host machine (this is answered by the#loopbackHost class method).Since a single machine can be a member of multiple networks, it can havemultiple Internet host addresses. However, there is never supposed to bemore than one machine with the same host address.There are four forms of the standard numbers-and-dots notation forInternet addresses: a.b.c.d specifies all four bytes of the addressindividually; a.b.c interprets as a 2-byte quantity, which is useful forspecifying host addresses in a Class B network with network address numbera.b; a.b intrprets the last part of the address as a 3-byte quantity,which is useful for specifying host addresses in a Class A network withnetwork address number a.If only one part is given, this corresponds directly to the host addressnumber. new new This method should not be called for instances of this class. with:with:with:with: with: b1 with: b2 with: b3 with: b4 Answer a new IPAddress whose bytes (from most-significantto least-significant) are in the parameters. TCP.IPAddress: accessing addressClass fromString:addressClass Answer the `address class' of the receiver (seeIPAddress class>>#fromString:) asByteArray asByteArray Answer a read-only ByteArray of size four containing thereceiver's bytes in network order (big-endian) host host Answer an host number for the receiver; this is given bythe last three bytes for class A addresses, by the lasttwo bytes for class B addresses, else by the last byte. isMulticast isMulticast Answer whether the receiver reprensents an address reserved formulticast datagram connections network network Answer a network number for the receiver; this is given by thefirst three bytes for class C/D/E addresses, by the first twobytes for class B addresses, else by the first byte. subnet subnet Answer an host number for the receiver; this is 0 for class Aaddresses, while it is given by the last byte of the networknumber for class B/C/D/E addresses. TCP.IPAddress: printing printOn:printOn: aStream Print the receiver in dot notation. TCP.MulticastSocket TCP.MulticastSocket Defined in namespace TCPSuperclass: TCP.DatagramSocketCategory: Sockets-Streams TCP.MulticastSocket: instance creation interfaceinterface Answer the local device supporting the multicast socket. Thisis usually set to any local address. interface: interface: ipAddress Set the local device supporting the multicast socket. Thisis usually set to any local address. join: join: ipAddress Join the multicast socket at the given IP address leave: leave: ipAddress Leave the multicast socket at the given IP address nextPut:timeToLive: nextPut: packet timeToLive: timeToLive Send the datagram with a specific TTL (time-to-live) timeToLive timeToLive Answer the socket's datagrams' default time-to-live timeToLive: timeToLive: newTTL Set the default time-to-live for the socket's datagrams TCP.MulticastSocketImpl TCP.MulticastSocketImpl Defined in namespace TCPSuperclass: TCP.DatagramSocketImplCategory: Sockets-Protocols TCP.MulticastSocketImpl: multicasting ipMulticastIfipMulticastIf Answer the local device for a multicast socket (in the form ofan address) ipMulticastIf: ipMulticastIf: interface Set the local device for a multicast socket (in the form ofan address, usually anyLocalAddress) join: join: ipAddress Join the multicast socket at the given address leave: leave: ipAddress Leave the multicast socket at the given address timeToLive timeToLive Answer the time to live of the datagrams sent through the receiverto a multicast socket. timeToLive: timeToLive: ttl Set the time to live of the datagrams sent through the receiverto a multicast socket. TCP.OOBSocketImpl TCP.OOBSocketImpl Defined in namespace TCPSuperclass: TCP.DatagramSocketImplCategory: Sockets-Protocols TCP.OOBSocketImpl class: implementation addressClassaddressClass Answer the class that holds network addresses for TCP sockets,i.e. IPAddress. TCP.OOBSocketImpl: C constants msgOOBmsgOOB Not commented. TCP.OOBSocketImpl: implementation canReadcanRead Answer whether out-of-band data is available on the socket ensureReadable ensureReadable Stop the process until an error occurs or out-of-band databecomes available on the socket TCP.RawSocketImpl TCP.RawSocketImpl Defined in namespace TCPSuperclass: TCP.DatagramSocketImplCategory: Sockets-Protocols TCP.RawSocketImpl class: parameters socketTypesocketType Answer the socket type parameter for `create'. TCP.ReadBuffer TCP.ReadBuffer Defined in namespace TCPSuperclass: ReadStreamCategory: Examples-Useful tools I'm a ReadStream that, when the end of the stream is reached,evaluates an user defined block to try to get some more data. TCP.ReadBuffer class: instance creation on:on: aCollection Answer a Stream that uses aCollection as a buffer. Youshould ensure that the fillBlock is set before the firstoperation, because the buffer will report that the datahas ended until you set the fillBlock. TCP.ReadBuffer: buffer handling atEndatEnd Answer whether the data stream has ended. bufferContents bufferContents Answer the data that is in the buffer, and empty it. fill fill Fill the buffer with more data if it is empty, and answertrue if the fill block was able to read more data. fillBlock: fillBlock: block Set the block that fills the buffer. It receives a collectionand the number of bytes to fill in it, and must return the numberof bytes actually read isEmpty isEmpty Answer whether the next input operation will force a buffer fill isFull isFull Answer whether the buffer has been just filled notEmpty notEmpty Check whether the next input operation will force a buffer filland answer true if it will not. pastEnd pastEnd Try to fill the buffer if the data stream has ended. TCP.ServerSocket TCP.ServerSocket Defined in namespace TCPSuperclass: TCP.AbstractSocketCategory: Sockets-Streams TCP.ServerSocket class: instance creation defaultQueueSize acceptdefaultQueueSize Answer the default length of the queue for pending connections. Whenthe queue fills, new clients attempting to connect fail until the serveris send #accept to accept a connection from the queue. port: port: anInteger Answer a new ServerSocket serving on any local address, on the givenport, with a pending connections queue of the default length. port:bindTo: port: anInteger bindTo: ipAddress Answer a new ServerSocket serving on the given address and port,with a pending connections queue of the default length. port:queueSize: port: anInteger queueSize: backlog Answer a new ServerSocket serving on any local address, on the givenport, with a pending connections queue of the given length. port:queueSize:bindTo: port: anInteger queueSize: backlog bindTo: ipAddress Answer a new ServerSocket serving on the given address and port,and with a pending connections queue of the given length. queueSize: queueSize: backlog Answer a new ServerSocket serving on any local address and port, with apending connections queue of the given length. queueSize:bindTo: queueSize: backlog bindTo: ipAddress Answer a new ServerSocket serving on the given local address,and on any port, with a pending connections queue of the given length. TCP.ServerSocket: accessing acceptaccept Accept a new connection and create a new instance of Socket if there isone, else answer nil. accept: accept: socketClass Accept a new connection and create a new instance of socketClass ifthere is one, else answer nil. This is usually needed only to createDatagramSockets. address address Answer the local address port port Answer the local port (the port that the passive socket is listening on). primAccept: primAccept: socketClass Accept a new connection and create a new instance of Socket if there isone, else fail. waitForConnection waitForConnection Wait for a connection to be available, and suspend the currentlyexecuting process in the meanwhile. TCP.ServerSocket: initializing port:queueSize:bindTo:port: anInteger queueSize: backlog bindTo: localAddr Initialize the ServerSocket so that it serves on the givenaddress and port, and has a pending connections queue ofthe given length. TCP.Socket TCP.Socket Defined in namespace TCPSuperclass: TCP.AbstractSocketCategory: Sockets-Streams TCP.Socket class: accessing defaultImplementationClassdefaultImplementationClass Answer the default implementation class. Depending on thesubclass, this might be the default stream socket implementationclass of the default address class, or rather its default datagramsocket implementation class readBufferSize readBufferSize Answer the size of the read buffer for newly-created sockets readBufferSize: readBufferSize: anInteger Set the size of the read buffer for newly-created sockets writeBufferSize writeBufferSize Answer the size of the write buffer for newly-created sockets writeBufferSize: writeBufferSize: anInteger Set the size of the write buffer for newly-created sockets TCP.Socket class: instance creation remote:port:remote: ipAddressOrString port: remotePort Create a new socket and connect to the given host (passed as aString to be resolved or as a SocketAddress), and to the given port. remote:port:local:port: remote: ipAddressOrString port: remotePort local: ipAddress port: localPort Create a new socket and connect to the given host (passed as aString to be resolved or as a SocketAddress), and to the given remotePort.Then bind it to the local address passed in ipAddress, on the localPortport; if the former is nil, any local address will do, and if the latteris 0, any local port will do. TCP.Socket class: tests loopbackTestloopbackTest Send data from one socket to another on the local machine. Tests most ofthe socket primitives. loopbackTest: loopbackTest: bufferSizes Send data from one socket to another on the local machine. Tests most ofthe socket primitives. The parameter is the size of the input andoutput buffer sizes. microTest microTest Extremely small test (try to receive SMTP header) producerConsumerTest producerConsumerTest Send data from one socket to another on the local machine. Tests most of thesocket primitives and works with different processes. sendTest sendTest Send data to the 'discard' socket of localhost. sendTest: sendTest: host Send data to the 'discard' socket of the given host. Tests the speed ofone-way data transfers across the network to the given host. Note thatmany hosts do not run a discard server. tweakedLoopbackTest tweakedLoopbackTest Send data from one socket to another on the local machine, trying to avoidbuffering overhead. Tests most of the socket primitives. Comparison ofthe results of loopbackTest and tweakedLoopbackTest should give a measureof the overhead of buffering when sending/receiving large quantities ofdata. udpLoopbackTest udpLoopbackTest Send data from one UDP socket to another on the local machine. Tests most of thesocket primitives and works with different processes. TCP.Socket class: well known ports defaultPortAt:defaultPortAt: protocol Answer the port that is used (by default) for the given service (highlevel protocol) defaultPortAt:ifAbsent: defaultPortAt: protocol ifAbsent: port Answer the port that is used (by default) for the given service (highlevel protocol), or the specified port if none is registered. defaultPortAt:put: defaultPortAt: protocol put: port Associate the given port to the service specified by `protocol'. initialize initialize Initialize the receiver's defaults portCmdServer portCmdServer Answer the port on which the rsh daemon listens portDayTime portDayTime Answer the port on which the TOD service listens portDiscard portDiscard Answer the port on which the DISCARD service listens portDNS portDNS Answer the port on which the DNS listens portEcho portEcho Answer the port on which the ECHO service listens portExecServer portExecServer Answer the port on which the exec server listens portFinger portFinger Answer the port on which the finger daemon listens portFTP portFTP Answer the port on which the FTP daemon listens portGopher portGopher Answer the port on which the Gopher daemon listens portHTTP portHTTP Answer the port on which the http daemon listens portLoginServer portLoginServer Answer the port on which the rlogin daemon listens portNetStat portNetStat Answer the port on which the NETSTAT service listens portNNTP portNNTP Answer the port on which the nntp daemon listens portPOP3 portPOP3 Answer the port on which the pop3 daemon listens portReserved portReserved Answer the last port reserved to privileged processes portSMTP portSMTP Answer the port on which the SMTP daemon listens portSSH portSSH Answer the port on which the SSH daemon listens portSystat portSystat Answer the port on which the SYSTAT service listens portTelnet portTelnet Answer the port on which the TELNET daemon listens portTimeServer portTimeServer Answer the port on which the time server listens portWhois portWhois Answer the port on which the WHOIS daemon listens TCP.Socket: accessing addressaddress Answer the address of the remote endpoint port port Answer the port of the remote endpoint TCP.Socket: out-of-band data outOfBandoutOfBand Return a datagram socket to be used for receiving out-of-band dataon the receiver. TCP.Socket: printing printOn:printOn: aStream Print a representation of the receiver on aStream TCP.Socket: stream protocol atEndatEnd Answer whether more data is available on the socket available available Answer whether more data is available in the socket's read bufferor from the operating system. bufferContents bufferContents Answer the current contents of the read buffer close close Flush and close the socket. fill fill Fill the read buffer with data read from the socket flush flush Flush the write buffer to the operating system isPeerAlive isPeerAlive Answer whether the connection with the peer remote machine is stillvalid. next next Read a byte from the socket. This might yield control to otherSmalltalk Processes. next: next: count Read `count' bytes from the socket. This might yield control to otherSmalltalk Processes. nextHunk nextHunk Answer the next buffers worth of stuff in the Stream representedby the receiver. Do at most one actual input operation. nextPut: nextPut: char Write a character to the socket; this acts as a bit-bucket whenthe socket is closed. This might yield control to otherSmalltalk Processes. nextPutAll: nextPutAll: aString Write aString to the socket; this acts as a bit-bucket whenthe socket is closed. This might yield control to otherSmalltalk Processes. peek peek Read a byte from the socket, without advancing the buffer; answernil if no more data is available. This might yield control to otherSmalltalk Processes. peekFor: peekFor: anObject Read a byte from the socket, advancing the buffer only if it matchesanObject; answer whether they did match or not. This might yieldcontrol to other Smalltalk Processes. readBufferSize: readBufferSize: size Create a new read buffer of the given size (which is onlypossible before the first read or if the current buffer isempty). writeBufferSize: writeBufferSize: size Create a new write buffer of the given size, flushing theold one is needed. This might yield control to otherSmalltalk Processes. TCP.SocketAddress TCP.SocketAddress Defined in namespace TCPSuperclass: ObjectCategory: Sockets-Protocols TCP.SocketAddress class: abstract fromSockAddr:port:fromSockAddr: aByteArray port: portAdaptor Private - Answer a new IPAddress from a ByteArray containing aC sockaddr structure. The portAdaptor's value is changedto contain the port that the structure refers to. TCP.SocketAddress class: accessing addressFamilyaddressFamily Answer the address family used for sockets whose endpoint isan instance of the receiver. anyLocalAddress anyLocalAddress Answer an IPAddress representing a local address. at:cache: at: host cache: aBlock Private - Answer the list of addresses associated to thegiven host in the cache. If the host is not cached yet,evaluate aBlock and cache and answer the result. defaultDatagramSocketImplClass defaultDatagramSocketImplClass Answer the class that, by default, is used to map between theSocket's protocol and a low-level C interface. defaultDatagramSocketImplClass: defaultDatagramSocketImplClass: aClass Set which class will be used by default to map between thereceiver's protocol and a low-level C interface. defaultRawSocketImplClass defaultRawSocketImplClass Answer the class that, by default, is used to map between theSocket's protocol and a low-level C interface. defaultRawSocketImplClass: defaultRawSocketImplClass: aClass Set which class will be used by default to map between thereceiver's protocol and a low-level C interface. defaultStreamSocketImplClass defaultStreamSocketImplClass Answer the class that, by default, is used to map between theSocket's protocol and a low-level C interface. defaultStreamSocketImplClass: defaultStreamSocketImplClass: aClass Set which class will be used by default to map between thereceiver's protocol and a low-level C interface. isDigitAddress: isDigitAddress: aString Answer whether the receiver can interpret aStrnig as a validaddress without going through a resolver. localHostName localHostName Answer the name of the local machine. loopbackHost loopbackHost Answer an instance of the receiver representing the local machine(127.0.0.1 in the IPv4 family). unknownAddress unknownAddress Answer an instance of the receiver representing an unknown machine(0.0.0.0 in the IPv4 family). TCP.SocketAddress class: C call-outs lookupAllHostAddr:withHostEnt:lookupAllHostAddr: name withHostEnt: cObject Not commented. primLocalName primLocalName Not commented. primName:len:type: primName: address len: len type: addressFamily Not commented. TCP.SocketAddress class: host name lookup allByName:allByName: aString Answer all the IP addresses that refer to the the given host. Ifa digit address is passed in aString, the result is an arraycontaining the single passed address. If the host could not beresolved to an IP address, answer nil. byName: fromString: byName: aString Answer a single IP address that refer to the the given host. Ifa digit address is passed in aString, the result is the same asusing #fromString:. If the host could not be resolved to an IPaddress, answer nil. TCP.SocketAddress class: initialization createLocalAddresscreateLocalAddress Answer an object representing a local address in the addressfamily for the receiver createLoopbackHost createLocalAddress createLoopbackHost Answer an object representing the loopback host in the addressfamily for the receiver. By default this is the same as#createLocalAddress, since the loopback host is actually alocal address that some implementations optimize specially. createUnknownAddress createUnknownAddress Answer an object representing an unkown address in the addressfamily for the receiver flush flush Flush the cached IP addresses. newRawSocket newRawSocket Create a new raw socket, providing access to low-level network protocolsand interfaces for the protocol family represented by the receiver(for example, the C protocol family PF_INET for the IPAddress class)Ordinary user programs usually have no need to use this method. update: update: aspect Flush all the caches for IPAddress subclasses TCP.SocketAddress: accessing == anIPAddress Answer whether the receiver and anIPAddress representthe same machine. The host name is not checked becausean IPAddress created before a DNS is activated is namedafter its numbers-and-dots notation, while the same IPAddress,created when a DNS is active, is named after its resolved name. asByteArray asByteArray Convert the receiver to a ByteArray passed to the operating system'ssocket functions) hash hash Answer an hash value for the receiver name name Answer the host name (or the digit notation if the DNS could notresolve the address). If the DNS answers a different IP addressfor the same name, the second response is not cached and the digitnotation is also returned (somebody's likely playing strange jokeswith your DNS). TCP.SocketImpl TCP.SocketImpl Defined in namespace TCPSuperclass: TCP.AbstractSocketImplCategory: Sockets-Protocols TCP.SocketImpl class: parameters socketTypesocketType Answer the socket type parameter for `create'. TCP.SocketImpl: abstract outOfBandImplClassoutOfBandImplClass Return an implementation class to be used for out-of-band dataon the receiver. TCP.SocketImpl: socket operations connectTo:port:connectTo: ipAddress port: port Try to connect the socket represented by the receiver to the given remotemachine. getPeerName getPeerName Retrieve a ByteArray containing a sockaddr_in struct for theremote endpoint of the socket. TCP.TCPSocketImpl TCP.TCPSocketImpl Defined in namespace TCPSuperclass: TCP.SocketImplCategory: Sockets-Protocols TCP.TCPSocketImpl class: C constants protocolprotocol Not commented. TCP.TCPSocketImpl class: implementation addressClassaddressClass Answer the class that holds network addresses for TCP sockets,i.e. IPAddress. TCP.TCPSocketImpl: implementation outOfBandImplClassoutOfBandImplClass Return an implementation class to be used for out-of-band dataon the receiver. TCP.UDPSocketImpl TCP.UDPSocketImpl Defined in namespace TCPSuperclass: TCP.MulticastSocketImplCategory: Sockets-Protocols TCP.UDPSocketImpl class: C constants ipprotoIpipprotoIp Not commented. protocol protocol Not commented. TCP.UDPSocketImpl class: implementation addressClassaddressClass Answer the class that holds network addresses for UDP sockets,i.e. IPAddress. TCP.UDPSocketImpl: multicasting ipMulticastIfipMulticastIf Answer the local device for a multicast socket (in the form ofan address) ipMulticastIf: ipMulticastIf: interface Set the local device for a multicast socket (in the form ofan address, usually anyLocalAddress) join: join: ipAddress Join the multicast socket at the given address leave: leave: ipAddress Leave the multicast socket at the given address primJoinLeave:option: primJoinLeave: ipAddress option: opt Private - Used to join or leave a multicast service. timeToLive timeToLive Answer the time to live of the datagrams sent through the receiverto a multicast socket. timeToLive: timeToLive: ttl Set the time to live of the datagrams sent through the receiverto a multicast socket. TCP.WriteBuffer TCP.WriteBuffer Defined in namespace TCPSuperclass: WriteStreamCategory: Examples-Useful tools I'm a WriteStream that, instead of growing the collection,evaluates an user defined block and starts over with the samecollection. TCP.WriteBuffer: buffer handling flushflush Evaluate the flushing block and reset the stream flushBlock: flushBlock: block Set which block will be used to flush the buffer.The block will be evaluated with a collection andan Integer n as parameters, and will have to writethe first n elements of the collection.