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

6.6 Sockets.DatagramSocket

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

This class models a connectionless datagram socket that sends individual packets of data across the network. In the TCP/IP world, this means UDP. Datagram packets do not have guaranteed delivery, or any guarantee about the order the data will be received on the remote host.

This class uses an underlying socket implementation object which is a subclass of DatagramSocketImpl. This is less necessary for datagram sockets than for stream sockets (except for hiding some methods in FileDescriptor that are not relevant to sockets), but it is done for cleanliness and symmetry.

6.6.1 Sockets.DatagramSocket class: accessing  (class)
6.6.2 Sockets.DatagramSocket class: initialization  (class)
6.6.3 Sockets.DatagramSocket class: instance creation  (class)
6.6.4 Sockets.DatagramSocket: accessing  (instance)
6.6.5 Sockets.DatagramSocket: direct operations  (instance)


6.6.1 Sockets.DatagramSocket class: accessing

defaultBufferSize
Answer the default maximum size for input datagrams.

defaultBufferSize: size
Set the default maximum size for input datagrams.

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.6.2 Sockets.DatagramSocket class: initialization

initialize
Initialize the class to use an input datagram size of 128.


6.6.3 Sockets.DatagramSocket class: instance creation

local: ipAddressOrString port: remotePort
Create a new socket and bind it to the given host (passed as a String to be resolved or as an IPAddress), on the given port.

new
Answer a new datagram socket (by default an UDP socket), without a specified local address and port.

port: localPort
Create a new socket and bind it to the local host on the given port.

remote: ipAddressOrString port: remotePort local: ipAddress port: localPort
Create a new socket and bind it to the given host (passed as a String to be resolved or as a SocketAddress), and to the given remotePort. The default destination for the datagrams will be ipAddressOrString (if not nil), on the remotePort port.


6.6.4 Sockets.DatagramSocket: accessing

address
Answer the local address.

bufferSize
Answer the size of the buffer in which datagrams are stored.

bufferSize: size
Set the size of the buffer in which datagrams are stored.

datagramClass
Answer the class used by the socket to return datagrams.

next
Read a datagram on the socket and answer it.

nextPut: aDatagram
Send the given datagram on the socket.

peek
Peek for a datagram on the socket and answer it.

peek: datagram
Peek for a datagram on the socket, store it in `datagram', and answer the datagram itself.

port
Answer the local port.

receive: datagram
Read a datagram from the socket, store it in `datagram', and answer the datagram itself.


6.6.5 Sockets.DatagramSocket: direct operations

nextFrom: ipAddress port: port
Answer the next datagram from the given address and port.



Back: Sockets.DatagramSocket-accessing Up: Sockets.DatagramSocket Forward: Sockets.DatagramSocketImpl   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on April, 16 2013 using texi2html