    indexing
    	description: "Generic sockets"
    	legal: "See notice at end of class."
    	status: "See notice at end of class."
    	date: "$Date: 2006-08-22 14:38:54 -0700 (Tue, 22 Aug 2006) $"
    	revision: "$Revision: 62875 $"

    class interface
    	SOCKET

    create {SOCKET}
    	create_from_descriptor (fd: INTEGER_32)
    			-- Create socket from descriptor `fd'.
    		ensure
    			family_valid: family = address.family
    			opened_all: is_open_write and is_open_read

    feature -- Initialization

    	create_from_descriptor (fd: INTEGER_32)
    			-- Create socket from descriptor `fd'.
    		ensure
    			family_valid: family = address.family
    			opened_all: is_open_write and is_open_read

    feature -- Access

    	generating_type: STRING_8
    			-- Name of current object's generating type
    			-- (type of which it is a direct instance)
    			-- (from ANY)

    	generator: STRING_8
    			-- Name of current object's generating class
    			-- (base class of the type of which it is a direct instance)
    			-- (from ANY)

    	retrieved: ANY
    			-- Retrieved object structure
    			-- To access resulting object under correct type,
    			-- use assignment attempt.
    			-- Will raise an exception (code Retrieve_exception)
    			-- if content is not a stored Eiffel structure.
    		require -- from IO_MEDIUM
    			is_readable: readable
    			support_storable: support_storable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read
    			support_storable: support_storable
    		ensure -- from IO_MEDIUM
    			result_exists: Result /= Void

    feature -- Comparison

    	frozen deep_equal (some: ANY; other: like arg #1): BOOLEAN
    			-- Are `some' and `other' either both void
    			-- or attached to isomorphic object structures?
    			-- (from ANY)
    		ensure -- from ANY
    			shallow_implies_deep: standard_equal (some, other) implies Result
    			both_or_none_void: (some = Void) implies (Result = (other = Void))
    			same_type: (Result and (some /= Void)) implies some.same_type (other)
    			symmetric: Result implies deep_equal (other, some)

    	frozen equal (some: ANY; other: like arg #1): BOOLEAN
    			-- Are `some' and `other' either both void or attached
    			-- to objects considered equal?
    			-- (from ANY)
    		ensure -- from ANY
    			definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.is_equal (other))

    	is_equal (other: like Current): BOOLEAN
    			-- Is `other' attached to an object considered
    			-- equal to current object?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			symmetric: Result implies other.is_equal (Current)
    			consistent: standard_is_equal (other) implies Result

    	frozen standard_equal (some: ANY; other: like arg #1): BOOLEAN
    			-- Are `some' and `other' either both void or attached to
    			-- field-by-field identical objects of the same type?
    			-- Always uses default object comparison criterion.
    			-- (from ANY)
    		ensure -- from ANY
    			definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.standard_is_equal (other))

    	frozen standard_is_equal (other: like Current): BOOLEAN
    			-- Is `other' attached to an object of the same type
    			-- as current object, and field-by-field identical to it?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			same_type: Result implies same_type (other)
    			symmetric: Result implies other.standard_is_equal (Current)

    feature -- Status report

    	address_in_use: BOOLEAN
    			-- Address is in use by another socket.
    			-- (from SOCKET_RESOURCES)

    	address_not_readable: BOOLEAN
    			-- Unreadable address
    			-- (from SOCKET_RESOURCES)

    	already_bound: BOOLEAN
    			-- Socket has already been bound.
    			-- (from SOCKET_RESOURCES)

    	bad_socket_handle: BOOLEAN
    			-- Socket descriptor is bad.
    			-- (from SOCKET_RESOURCES)

    	bytes_read: INTEGER_32
    			-- Last number of bytes read by read_to_managed_pointer.
    			-- (from IO_MEDIUM)

    	conforms_to (other: ANY): BOOLEAN
    			-- Does type of current object conform to type
    			-- of `other' (as per Eiffel: The Language, chapter 13)?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void

    	connect_in_progress: BOOLEAN
    			-- Call to connect returned on a non-blocking socket.
    			-- (from SOCKET_RESOURCES)

    	connection_refused: BOOLEAN
    			-- Connection is refused (possibly due to security).
    			-- (from SOCKET_RESOURCES)

    	dtable_full: BOOLEAN
    			-- Descriptor table is full
    			-- (from SOCKET_RESOURCES)

    	error: STRING_8
    			-- Output a related error message.
    			-- (from SOCKET_RESOURCES)

    	error_number: INTEGER_32
    			-- Returned error number
    			-- (from SOCKET_RESOURCES)

    	expired_socket: BOOLEAN
    			-- Socket connection has expired.
    			-- (from SOCKET_RESOURCES)

    	invalid_address: BOOLEAN
    			-- Address is not valid.
    			-- (from SOCKET_RESOURCES)

    	invalid_socket_handle: BOOLEAN
    			-- Socket descriptor is not valid.
    			-- (from SOCKET_RESOURCES)

    	is_plain_text: BOOLEAN
    			-- Is file reserved for text (character sequences)?
    			-- (from IO_MEDIUM)

    	is_valid_peer_address (addr: SOCKET_ADDRESS): BOOLEAN
    			-- Is `addr' a valid peer address?
    		require
    			address_exists: addr /= Void

    	last_character: CHARACTER_8
    			-- Last character read by read_character
    			-- (from IO_MEDIUM)

    	last_double: REAL_64
    			-- Last double read by read_double
    			-- (from IO_MEDIUM)

    	last_integer: INTEGER_32
    			-- Last integer read by read_integer
    			-- (from IO_MEDIUM)

    	last_integer_16: INTEGER_16
    			-- Last 16-bit integer read by read_integer_16
    			-- (from IO_MEDIUM)

    	last_integer_32: INTEGER_32
    			-- Synonymy of last_integer
    			-- (from IO_MEDIUM)

    	last_integer_64: INTEGER_64
    			-- Last 64-bit integer read by read_integer_64
    			-- (from IO_MEDIUM)

    	last_integer_8: INTEGER_8
    			-- Last 8-bit integer read by read_integer_8
    			-- (from IO_MEDIUM)

    	last_natural: NATURAL_32
    			-- Last 32-bit natural read by read_natural
    			-- (from IO_MEDIUM)

    	last_natural_16: NATURAL_16
    			-- Last 16-bit natural read by read_natural_16
    			-- (from IO_MEDIUM)

    	last_natural_32: NATURAL_32
    			-- Synonymy of last_natural
    			-- (from IO_MEDIUM)

    	last_natural_64: NATURAL_64
    			-- Last 64-bit natural read by read_natural_64
    			-- (from IO_MEDIUM)

    	last_natural_8: NATURAL_8
    			-- Last 8-bit natural read by read_natural_8
    			-- (from IO_MEDIUM)

    	last_real: REAL_32
    			-- Last real read by read_real
    			-- (from IO_MEDIUM)

    	last_string: STRING_8
    			-- Last string read
    			-- (from IO_MEDIUM)

    	network: BOOLEAN
    			-- Socket failed due to network problems.
    			-- (from SOCKET_RESOURCES)

    	no_buffers: BOOLEAN
    			-- No more buffers available
    			-- (from SOCKET_RESOURCES)

    	no_permission: BOOLEAN
    			-- No permission is given to user for this socket.
    			-- (from SOCKET_RESOURCES)

    	not_connected: BOOLEAN
    			-- Socket is not connect.
    			-- (from SOCKET_RESOURCES)

    	protected_address: BOOLEAN
    			-- No access to this address is allowed.
    			-- (from SOCKET_RESOURCES)

    	protocol_not_supported: BOOLEAN
    			-- Protocol is not supported on this platform.
    			-- (from SOCKET_RESOURCES)

    	same_type (other: ANY): BOOLEAN
    			-- Is type of current object identical to type of `other'?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			definition: Result = (conforms_to (other) and other.conforms_to (Current))

    	socket_family_not_supported: BOOLEAN
    			-- Requested family is not supported.
    			-- (from SOCKET_RESOURCES)

    	socket_in_use: BOOLEAN
    			-- Socket is already in use.
    			-- (from SOCKET_RESOURCES)

    	socket_ok: BOOLEAN
    			-- No error
    			-- (from SOCKET_RESOURCES)

    	socket_would_block: BOOLEAN
    			-- Call to read, write, etc would have blocked.
    			-- (from SOCKET_RESOURCES)

    	support_storable: BOOLEAN
    			-- Can medium be used to store an Eiffel structure?

    	zero_option: BOOLEAN
    			-- No options provided
    			-- (from SOCKET_RESOURCES)

    feature -- Element change

    	basic_store (object: ANY)
    			-- Produce an external representation of the
    			-- entire object structure reachable from `object'.
    			-- Retrievable within current system only.
    		require -- from IO_MEDIUM
    			object_not_void: object /= Void
    			extendible: extendible
    			support_storable: support_storable
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write
    			support_storable: support_storable

    	general_store (object: ANY)
    			-- Produce an external representation of the
    			-- entire object structure reachable from `object'.
    			-- Retrievable from other systems for same platform
    			-- (machine architecture).
    		require -- from IO_MEDIUM
    			object_not_void: object /= Void
    			extendible: extendible
    			support_storable: support_storable
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write
    			support_storable: support_storable

    	independent_store (object: ANY)
    			-- Produce an external representation of the
    			-- entire object structure reachable from `object'.
    			-- Retrievable from other systems for the same or other
    			-- platform (machine architecture).
    		require -- from IO_MEDIUM
    			object_not_void: object /= Void
    			extendible: extendible
    			support_storable: support_storable
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write
    			support_storable: support_storable

    feature -- Removal

    	dispose
    			-- Ensure this medium is closed when garbage collected.
    			-- (from IO_MEDIUM)

    feature -- Duplication

    	copy (other: like Current)
    			-- Update current object using fields of object attached
    			-- to `other', so as to yield equal objects.
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    			type_identity: same_type (other)
    		ensure -- from ANY
    			is_equal: is_equal (other)

    	frozen deep_copy (other: like Current)
    			-- Effect equivalent to that of:
    			--		copy (`other' . deep_twin)
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			deep_equal: deep_equal (Current, other)

    	frozen deep_twin: like Current
    			-- New object structure recursively duplicated from Current.
    			-- (from ANY)
    		ensure -- from ANY
    			deep_equal: deep_equal (Current, Result)

    	frozen standard_copy (other: like Current)
    			-- Copy every field of `other' onto corresponding field
    			-- of current object.
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    			type_identity: same_type (other)
    		ensure -- from ANY
    			is_standard_equal: standard_is_equal (other)

    	frozen standard_twin: like Current
    			-- New object field-by-field identical to `other'.
    			-- Always uses default copying semantics.
    			-- (from ANY)
    		ensure -- from ANY
    			standard_twin_not_void: Result /= Void
    			equal: standard_equal (Result, Current)

    	frozen twin: like Current
    			-- New object equal to `Current'
    			-- twin calls copy; to change copying/twining semantics, redefine copy.
    			-- (from ANY)
    		ensure -- from ANY
    			twin_not_void: Result /= Void
    			is_equal: Result.is_equal (Current)

    feature -- Miscellaneous

    	name: STRING_8
    			-- Socket name
    		require -- from  IO_MEDIUM
    			True
    		require else
    			socket_exists: exists

    feature -- Basic operations

    	frozen default: like Current
    			-- Default value of object's type
    			-- (from ANY)

    	frozen default_pointer: POINTER
    			-- Default value of type `POINTER'
    			-- (Avoid the need to write `p'.default for
    			-- some `p' of type `POINTER'.)
    			-- (from ANY)

    	default_rescue
    			-- Process exception for routines with no Rescue clause.
    			-- (Default: do nothing.)
    			-- (from ANY)

    	frozen do_nothing
    			-- Execute a null action.
    			-- (from ANY)

    feature -- Obsolete

    	lastchar: CHARACTER_8
    			-- Last character read by read_character
    			-- (from IO_MEDIUM)

    	lastdouble: REAL_64
    			-- Last double read by read_double
    			-- (from IO_MEDIUM)

    	lastint: INTEGER_32
    			-- Last integer read by read_integer
    			-- (from IO_MEDIUM)

    	lastreal: REAL_32
    			-- Last real read by read_real
    			-- (from IO_MEDIUM)

    	laststring: STRING_8
    			-- Last string read
    			-- (from IO_MEDIUM)

    feature -- Basic commands

    	address: SOCKET_ADDRESS
    			-- Local address of socket

    	bind
    			-- Bind socket to local address in address.
    		require
    			socket_exists: exists
    			valid_local_address: address /= Void

    	cleanup
    			-- Cleanup socket.

    	close
    			-- Close socket for all context.
    		require -- from IO_MEDIUM
    			medium_is_open: not is_closed
    		require else
    			socket_exists: exists

    	close_socket
    			-- Close socket for current context.
    		require
    			socket_exists: exists
    			is_open: is_open_read or is_open_write
    		ensure
    			is_closed: is_closed
    			not_is_open: not is_open_read and not is_open_write

    	connect
    			-- Connect socket to peer address.
    		require
    			socket_exists: exists
    			valid_peer_address: peer_address /= Void

    	descriptor: INTEGER_32
    			-- Socket descriptor of current socket

    	descriptor_available: BOOLEAN
    			-- Is descriptor available?

    	family: INTEGER_32
    			-- Socket family eg. af_inet, af_unix

    	is_closed: BOOLEAN
    			-- Is socket closed?

    	make_socket
    			-- Create socket descriptor.
    		require
    			valid_family: family >= 0
    			valid_type: type >= 0
    			valid_protocol: protocol >= 0

    	peer_address: like address
    			-- Peer address of socket

    	protocol: INTEGER_32
    			-- Protocol of the socket. default 0
    			-- means for the system to chose the default
    			-- protocol for the family chosen. eg. `udp', `tcp'.

    	set_address (addr: like address)
    			-- Set local address to `addr'.
    		require
    			same_type: addr.family = family
    		ensure
    			address_set: address = addr

    	set_peer_address (addr: like address)
    			-- Set peer address to `addr'.
    		require
    			address_exists: addr /= Void
    			address_valid: is_valid_peer_address (addr)
    		ensure
    			address_set: peer_address = addr

    	type: INTEGER_32
    			-- Type of socket. eg stream, datagram

    feature -- Externals: flags for send, sendto recv and recvfrom socket calls

    	c_msgdontroute: INTEGER_32
    			-- Do not route message
    			-- (from SOCKET_RESOURCES)

    	c_oobmsg: INTEGER_32
    			-- Out of bound message
    			-- (from SOCKET_RESOURCES)

    	c_peekmsg: INTEGER_32
    			-- Peek message
    			-- (from SOCKET_RESOURCES)

    feature -- Input

    	last_boolean: BOOLEAN
    			-- Last boolean read by read_boolean

    	read (size: INTEGER_32): PACKET
    			-- Read a packet of data of maximum size `size'.
    		require
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_boolean
    			-- Read a new boolean.
    			-- Maker result available in last_boolean.
    			-- Was declared in SOCKET as synonym of readbool.
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_character
    			-- Read a new character.
    			-- Make result available in last_character.
    			-- Was declared in SOCKET as synonym of readchar.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_double
    			-- Read a new double.
    			-- Make result available in last_double.
    			-- Was declared in SOCKET as synonym of readdouble.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_integer
    			-- Read a new 32-bit integer.
    			-- Make result available in last_integer.
    			-- Was declared in SOCKET as synonym of readint and read_integer_32.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_integer_16
    			-- Read a new 16-bit integer.
    			-- Make result available in last_integer_16.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_integer_32
    			-- Read a new 32-bit integer.
    			-- Make result available in last_integer.
    			-- Was declared in SOCKET as synonym of read_integer and readint.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_integer_64
    			-- Read a new 64-bit integer.
    			-- Make result available in last_integer_64.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_integer_8
    			-- Read a new 8-bit integer.
    			-- Make result available in last_integer_8.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_line
    			-- Read a line of characters (ended by a new_line).
    			-- Was declared in SOCKET as synonym of readline.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read
    		ensure -- from IO_MEDIUM
    			last_string_not_void: last_string /= Void

    	read_natural
    			-- Read a new 32-bit natural.
    			-- Make result available in last_natural.
    			-- Was declared in SOCKET as synonym of read_natural_32.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_natural_16
    			-- Read a new 16-bit natural.
    			-- Make result available in last_natural_16.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_natural_32
    			-- Read a new 32-bit natural.
    			-- Make result available in last_natural.
    			-- Was declared in SOCKET as synonym of read_natural.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_natural_64
    			-- Read a new 64-bit natural.
    			-- Make result available in last_natural_64.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_natural_8
    			-- Read a new 8-bit natural.
    			-- Make result available in last_natural_8.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_real
    			-- Read a new real.
    			-- Make result available in last_real.
    			-- Was declared in SOCKET as synonym of readreal.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	read_stream (nb_char: INTEGER_32)
    			-- Read a string of at most `nb_char' characters.
    			-- Make result available in last_string.
    			-- Was declared in SOCKET as synonym of readstream.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read
    		ensure -- from IO_MEDIUM
    			last_string_not_void: last_string /= Void

    	read_to_managed_pointer (p: MANAGED_POINTER; start_pos, nb_bytes: INTEGER_32)
    			-- Read at most `nb_bytes' bound bytes and make result
    			-- available in `p' at position `start_pos'.
    		require -- from IO_MEDIUM
    			p_not_void: p /= Void
    			p_large_enough: p.count >= nb_bytes + start_pos
    			nb_bytes_non_negative: nb_bytes >= 0
    			is_readable: readable
    		require else
    			p_not_void: p /= Void
    			p_large_enough: p.count >= nb_bytes + start_pos
    			nb_bytes_non_negative: nb_bytes >= 0
    			socket_exists: exists
    			opened_for_read: is_open_read
    		ensure -- from IO_MEDIUM
    			bytes_read_non_negative: bytes_read >= 0
    			bytes_read_not_too_big: bytes_read <= nb_bytes

    	readbool
    			-- Read a new boolean.
    			-- Maker result available in last_boolean.
    			-- Was declared in SOCKET as synonym of read_boolean.
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	readchar
    			-- Read a new character.
    			-- Make result available in last_character.
    			-- Was declared in SOCKET as synonym of read_character.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	readdouble
    			-- Read a new double.
    			-- Make result available in last_double.
    			-- Was declared in SOCKET as synonym of read_double.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	readint
    			-- Read a new 32-bit integer.
    			-- Make result available in last_integer.
    			-- Was declared in SOCKET as synonym of read_integer and read_integer_32.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	readline
    			-- Read a line of characters (ended by a new_line).
    			-- Was declared in SOCKET as synonym of read_line.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read
    		ensure -- from IO_MEDIUM
    			last_string_not_void: last_string /= Void

    	readreal
    			-- Read a new real.
    			-- Make result available in last_real.
    			-- Was declared in SOCKET as synonym of read_real.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read

    	readstream (nb_char: INTEGER_32)
    			-- Read a string of at most `nb_char' characters.
    			-- Make result available in last_string.
    			-- Was declared in SOCKET as synonym of read_stream.
    		require -- from IO_MEDIUM
    			is_readable: readable
    		require else
    			socket_exists: exists
    			opened_for_read: is_open_read
    		ensure -- from IO_MEDIUM
    			last_string_not_void: last_string /= Void

    	receive (size, flags: INTEGER_32): PACKET
    			-- Receive a packet of maximum size `size'.
    		require
    			socket_exists: exists
    			opened_for_read: is_open_read

    feature -- Output

    	exists: BOOLEAN
    			-- Does socket exist?

    	extendible: BOOLEAN
    			-- May new items be added?

    	io: STD_FILES
    			-- Handle to standard file setup
    			-- (from ANY)

    	is_executable: BOOLEAN
    			-- Is socket an executable?
    		require -- from IO_MEDIUM
    			handle_exists: exists

    	is_open_read: BOOLEAN
    			-- Is socket opened for reading?

    	is_open_write: BOOLEAN
    			-- Is socket opened for writing?

    	is_readable: BOOLEAN
    			-- Is socket a readable medium?
    		require -- from IO_MEDIUM
    			handle_exists: exists

    	is_writable: BOOLEAN
    			-- Is socket a writable medium?
    		require -- from IO_MEDIUM
    			handle_exists: exists

    	new_line
    			-- Write a "new_line" character to socket.
    			-- Was declared in SOCKET as synonym of put_new_line.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	out: STRING_8
    			-- New string containing terse printable representation
    			-- of current object
    			-- Was declared in ANY as synonym of tagged_out.
    			-- (from ANY)

    	print (some: ANY)
    			-- Write terse external representation of `some'
    			-- on standard output.
    			-- (from ANY)

    	put_boolean (b: BOOLEAN)
    			-- Write boolean `b' to socket.
    			-- Was declared in SOCKET as synonym of putbool.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_character (c: CHARACTER_8)
    			-- Write character `c' to socket.
    			-- Was declared in SOCKET as synonym of putchar.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_double (d: REAL_64)
    			-- Write double `d' to socket.
    			-- Was declared in SOCKET as synonym of putdouble.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_integer (i: INTEGER_32)
    			-- Write integer `i' to socket.
    			-- Was declared in SOCKET as synonym of putint and put_integer_32.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_integer_16 (i: INTEGER_16)
    			-- Write integer `i' to socket.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_integer_32 (i: INTEGER_32)
    			-- Write integer `i' to socket.
    			-- Was declared in SOCKET as synonym of put_integer and putint.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_integer_64 (i: INTEGER_64)
    			-- Write integer `i' to socket.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_integer_8 (i: INTEGER_8)
    			-- Write integer `i' to socket.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_managed_pointer (p: MANAGED_POINTER; start_pos, nb_bytes: INTEGER_32)
    			-- Put data of length `nb_bytes' pointed by `start_pos' index in `p' at
    			-- current position.
    		require -- from IO_MEDIUM
    			p_not_void: p /= Void
    			p_large_enough: p.count >= nb_bytes + start_pos
    			nb_bytes_non_negative: nb_bytes >= 0
    			extendible: extendible
    		require else
    			p_not_void: p /= Void
    			p_large_enough: p.count >= nb_bytes + start_pos
    			nb_bytes_non_negative: nb_bytes >= 0
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_natural (i: NATURAL_32)
    			-- Write natural `i' to socket.
    			-- Was declared in SOCKET as synonym of put_natural_32.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_natural_16 (i: NATURAL_16)
    			-- Write natural `i' to socket.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_natural_32 (i: NATURAL_32)
    			-- Write natural `i' to socket.
    			-- Was declared in SOCKET as synonym of put_natural.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_natural_64 (i: NATURAL_64)
    			-- Write natural `i' to socket.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_natural_8 (i: NATURAL_8)
    			-- Write natural `i' to socket.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_new_line
    			-- Write a "new_line" character to socket.
    			-- Was declared in SOCKET as synonym of new_line.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_real (r: REAL_32)
    			-- Write real `r' to socket.
    			-- Was declared in SOCKET as synonym of putreal.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	put_string (s: STRING_8)
    			-- Write string `s' to socket.
    			-- Was declared in SOCKET as synonym of putstring.
    		require -- from IO_MEDIUM
    			extendible: extendible
    			non_void: s /= Void
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	putbool (b: BOOLEAN)
    			-- Write boolean `b' to socket.
    			-- Was declared in SOCKET as synonym of put_boolean.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	putchar (c: CHARACTER_8)
    			-- Write character `c' to socket.
    			-- Was declared in SOCKET as synonym of put_character.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	putdouble (d: REAL_64)
    			-- Write double `d' to socket.
    			-- Was declared in SOCKET as synonym of put_double.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	putint (i: INTEGER_32)
    			-- Write integer `i' to socket.
    			-- Was declared in SOCKET as synonym of put_integer and put_integer_32.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	putreal (r: REAL_32)
    			-- Write real `r' to socket.
    			-- Was declared in SOCKET as synonym of put_real.
    		require -- from IO_MEDIUM
    			extendible: extendible
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	putstring (s: STRING_8)
    			-- Write string `s' to socket.
    			-- Was declared in SOCKET as synonym of put_string.
    		require -- from IO_MEDIUM
    			extendible: extendible
    			non_void: s /= Void
    		require else
    			socket_exists: exists
    			opened_for_write: is_open_write

    	readable: BOOLEAN
    			-- Is there currently any data available on socket?
    		require -- from IO_MEDIUM
    			handle_exists: exists

    	send (a_packet: PACKET; flags: INTEGER_32)
    			-- Send a packet `a_packet' of data to socket.
    		require
    			socket_exists: exists
    			opened_for_write: is_open_write
    			valid_packet: a_packet /= Void

    	frozen tagged_out: STRING_8
    			-- New string containing terse printable representation
    			-- of current object
    			-- Was declared in ANY as synonym of out.
    			-- (from ANY)

    	write (a_packet: PACKET)
    			-- Write packet `a_packet' to socket.
    		require
    			socket_exists: exists
    			opened_for_write: is_open_write

    feature -- Platform

    	operating_environment: OPERATING_ENVIRONMENT
    			-- Objects available from the operating system
    			-- (from ANY)

    feature -- socket options

    	debug_enabled: BOOLEAN
    			-- Is socket system debugging enabled?
    		require
    			socket_exists: exists

    	disable_debug
    			-- Disable socket system debugging.
    		require
    			socket_exists: exists

    	do_not_route
    			-- Set socket to non-routing.
    		require
    			socket_exists: exists

    	enable_debug
    			-- Enable socket system debugging.
    		require
    			socket_exists: exists

    	group_id: INTEGER_32
    			-- Group id of socket
    		require
    			socket_exists: exists
    			group_set: is_group_id

    	is_blocking: BOOLEAN
    			-- Is the socket blocking?

    	is_group_id: BOOLEAN
    			-- Is the owner id the socket group id?
    		require
    			socket_exists: exists

    	is_process_id: BOOLEAN
    			-- Is the owner id the socket process id?
    		require
    			socket_exists: exists

    	is_socket_stream: BOOLEAN
    			-- Is the socket a stream?
    		require
    			socket_exists: exists

    	process_id: INTEGER_32
    			-- Process id of socket
    		require
    			socket_exists: exists
    			process_set: is_process_id

    	receive_buf_size: INTEGER_32
    			-- Size of receive buffer.
    		require
    			socket_exists: exists

    	route
    			-- Set socket to routing.
    		require
    			socket_exists: exists

    	route_enabled: BOOLEAN
    			-- Is routing enabled?
    		require
    			socket_exists: exists

    	send_buf_size: INTEGER_32
    			-- Size of send buffer.
    		require
    			socket_exists: exists

    	set_blocking
    			-- Set socket to blocking mode.
    		require
    			socket_exists: exists
    		ensure
    			is_blocking

    	set_non_blocking
    			-- Set socket to non-blocking mode.
    		require
    			socket_exists: exists
    		ensure
    			not is_blocking

    	set_owner (own: INTEGER_32)
    			-- Negative value sets group process id.
    			-- positive value sets process id.
    		require
    			socket_exists: exists
    			valid_owner: own /= 0 and own /= -1
    		ensure
    			set_id: own < -1 implies own = group_id or else own > 0 implies own = process_id

    	set_receive_buf_size (s: INTEGER_32)
    			-- Set receive buffer size.
    		require
    			socket_exists: exists
    		ensure
    			size_set: s = receive_buf_size

    	set_send_buf_size (s: INTEGER_32)
    			-- Set the send buffer to size `s'.
    		require
    			socket_exists: exists
    		ensure
    			size_set: s = send_buf_size

    invariant
    		-- from ANY
    	reflexive_equality: standard_is_equal (Current)
    	reflexive_conformance: conforms_to (Current)

    indexing
    	copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
    	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
    	source: "[
    		Eiffel Software
    		356 Storke Road, Goleta, CA 93117 USA
    		Telephone 805-685-1006, Fax 805-685-6869
    		Website http://www.eiffel.com
    		Customer support http://support.eiffel.com
    	]"

    end -- class SOCKET