Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.network.classic

Class EM_UDP_PACKET


Direct ancestors

EM_NETWORK_CONSTANTS, SDL_NET_FUNCTIONS, EXCEPTIONS

Creation

Features

Invariants

indexing

description

A UDP packet that contains data to be sent over a network using the non-reliable
User Datagram Protocol.

date

$Date: 2005/10/26 18:49:24 $

revision

$Revision: 1.18 $

class

EM_UDP_PACKET

create

make

-- Creates a new UDP packet.

create {EM_SIMPLE_UDP_SOCKET, EM_UDP_SOCKET}

make_from_struct (a_packet_struct: UDPPACKET_STRUCT)

-- Copy data from existing UDPSTRUCT

feature -- Access

address: EM_INET_SOCKET_ADDRESS

-- Returns the address of the packet.
-- If you've just received the packet, this is the address of the source host.

count: INTEGER

-- Represents the packet's size in bytes.

item: STRING

-- Returns the packet data as a string.

ensure
result_correct: Result = data

feature -- Element change

put_string (a_string: STRING)

-- Sets a_string as the packet data.

require
a_string_not_void: a_string /= Void
ensure
data_correct_set: data = a_string
set_address (an_inet_socket_address: EM_INET_SOCKET_ADDRESS)

-- Sets an_inet_socket_address as the address of the packet.
-- If you prepare a packet for sending, this will be the destination
-- address the packet will be sent to.

require
an_inet_socket_address_not_void: an_inet_socket_address /= Void
ensure
address_set: address = an_inet_socket_address

feature -- Status

is_empty: BOOLEAN

-- True, if the current packet is empty.

feature {EM_SIMPLE_UDP_SOCKET, EM_UDP_SOCKET} -- Implementation

udp_packet_struct: UDPPACKET_STRUCT

-- C struct representation of the packet.

invariant

invariant_clause: True

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end