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

em.network.classic

Class EM_TCP_SERVER_SOCKET


Direct ancestors

EM_SOCKET, EM_SHARED_SUBSYSTEMS, EM_SHARED_ERROR_HANDLER, NET2_FUNCTIONS_EXTERNAL

Creation

Features

Invariants

indexing

description

A TCP server socket that listens at a port on all local interfaces
for incomming connection attempts.

date

$Date$

revision

$Revision$

class

EM_TCP_SERVER_SOCKET

inherit

EM_SOCKET

create

make

-- Initialise new server socket.

ensure
not_open: not is_open
port_not_set: port = -1

feature -- Access

network_subsystem: EM_NETWORK_SUBSYSTEM

-- EiffelMedia network subsystem is

-- (From EM_SHARED_SUBSYSTEMS)

ensure
network_subsystem_not_void: Result /= void
port: INTEGER

-- Local socket port

-- (From EM_SOCKET)

feature -- Status setting

close

-- Close server.

-- (From EM_SOCKET)

require
network_enabled: Network_subsystem.is_enabled
open: is_open
ensure
closed: not is_open
open

-- Open server on port.

-- (From EM_SOCKET)

require
network_enabled: Network_subsystem.is_enabled
closed: not is_open
port_set: 1024 < port and port < 65536
ensure then
open: is_open

feature -- Element change

set_port (a_port: INTEGER)

-- Set port to a_port.

-- (From EM_SOCKET)

require
a_port_in_range: 1024 < a_port and a_port < 65536
ensure
port_set: port = a_port

feature -- Events

connection_accepted_event: EM_EVENT_TYPE [TUPLE [EM_TCP_CLIENT_SOCKET]]

-- Connection accepted event

feature -- Status

is_open: BOOLEAN

-- Is socket open?

-- (From EM_SOCKET)

feature {EM_SOCKETS} -- Implementation

handle_connection_accepted (a_client_socket: EM_TCP_CLIENT_SOCKET)

-- Handle connection accepted.

handle_data_received

-- Handle data received event.

-- (From EM_SOCKET)

net2_socket_id: INTEGER

-- Socket id of Net2

-- (From EM_SOCKET)

invariant

connection_accepted_event_not_void: connection_accepted_event /= Void

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

end