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

6.5 Sockets.Datagram

Defined in namespace Sockets
Superclass: Object
Category: Sockets-Protocols

This class models a packet of data that is to be sent across the network using a connectionless protocol such as UDP. It contains the data to be send, as well as the destination address and port. Note that datagram packets can arrive in any order and are not guaranteed to be delivered at all.

This class can also be used for receiving data from the network.

6.5.1 Sockets.Datagram class: instance creation  (class)
6.5.2 Sockets.Datagram: accessing  (instance)


6.5.1 Sockets.Datagram class: instance creation

data: aByteArray
Answer a new datagram with the specified data.

data: aByteArray address: ipAddress port: port
Answer a new datagram with the specified target socket, and aByteArray as its data.

object: object address: ipAddress port: port
Serialize the object onto a ByteArray, and create a Datagram with the object as its contents, and the specified receiver. Note that each invocation of this method creates a separate ObjectDumper; if different objects that you're sending are likely to contain references to the same objects, you should use #object:objectDumper:address:port:.

object: object objectDumper: od address: ipAddress port: port
Serialize the object onto a ByteArray, and create a Datagram with the object as its contents, and the specified receiver. Serialization takes place through ObjectDumper passed as `od', and the stream attached to the ObjectDumper is resetted every time. Using this method is indicated if different objects that you're sending are likely to contain references to the same objects.


6.5.2 Sockets.Datagram: accessing

address
Answer the address of the target socket

address: ipAddress
Set the address of the target socket

data
Answer the data attached to the datagram

data: aByteArray
Set the data attached to the datagram

dataSize
Answer the size of the message.

dataSize: aSize
I am called to update the size...

get
Parse the data attached to the datagram through a newly created ObjectDumper, and answer the resulting object. This method is complementary to #object:address:port:.

getThrough: objectDumper
Parse the data attached to the datagram through the given ObjectDumper without touching the stream to which it is attached, and answer the resulting object. The state of the ObjectDumper, though, is updated. This method is complementary to #object:objectDumper:address:port:.

port
Answer the IP port of the target socket

port: thePort
Set the IP port of the target socket

size
I determine the size of the datagram. It is either an explicitly specified dataSize, or the size of the whole collection.



Back: Sockets.Datagram class-instance creation Up: Sockets.Datagram Forward: Sockets.DatagramSocket   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