Aztec® Programming Language
Version 1.1 Alpha 2

Copyright © 2010-2017, Aztec Development Group, All Rights Reserved

Download Aztec

Search        Contact Us

And it's just beyond my vision.

- Jonathan Edwards

 

aztec.io.Socket

public class Socket from<Base>

Base

Socket

Socket is an abstract class which provides a framework for socket based communications. It is designed to be used as a simple client/server model.

 

A ServerSocket object is created and waits for connections. When a valid connection request comes in, a ClientSocket object is created to communicate with the remote application. The ClientSocket object in turn creates a SocketStream object and ties it to the socket connection. All I/O performed on the SocketStream object results in communication with the remote application via the socket.

 

The following diagram shows a high level representation of a typical socket communication process between a client and server. A key point is that the ServerSocket class is primarily responsible for listening on a port, accepting an incoming connection, and the creating the ClientSocket object to communicate with the remote socket. The connection then becomes a peer to peer socket connection between two ClientSocket objects.

Socket Communication Process

 

Socket Methods

Socket() Constructor for the abstract Socket class
IsValid() Returns true if the socket is valid
Port() Returns the associated port number
Close() Abstract method to close the socket

Derived Classes

See Also

 


Socket()

public method Socket(int PortNumber = 0)

Parameters

PortNumber

Port number (0 for client and non-zero for server)

Return Value

None

Description

Constructor for the abstract Socket class. The port number is passed in, though for ClientSocket objects, the port number is zero at creation and it is specified during the Connect() process. Once the Connect operation is complete, the internal port number value is set to that port number. For ServerSocket objects,it must be a valid port number, and it is the port that's used to listen for incoming requests.

 

Socket Class


IsValid()

public method<bool> IsValid()

Parameters

None

Return Value

True if the socket is valid

Description

This method returns true if the underlying system socket is valid and false if not. As long as sockets are properly setup at the operating system level on the computer, this valid flag should be true. No socket I/O operations will be allowed with this object if the underlying system socket is not valid.

 

Socket Class


Port()

public method<int> Port()

Parameters

None

Return Value

Returns the associated port number

Description

Returns the port number associated with this socet. If it's a server socket, the port number is specified during creation, and won't change during the lifetime of the socket object. If it's a client socket, the port number is zero at startup and is set after a successful Connect() call.

 

Socket Class


Close()

public abstract method Close()

Parameters

None

Return Value

None

Description

This abstract method closes the socket. Each derived class must override this method and handle the closing of the socket appropriately.

 

Socket Class

 

Copyright © 2010-2017

Aztec Development Group

All Rights Reserved

Download Aztec