RealSystem's Network Services provides cross-platform methods for managing network communictions. Any server-side or client-side RealSystem component can use Network Services to create TCP or UDP connections for reading and writing data. Network Services also provides interfaces that let components resolve DNS host names and listen for TCP connections on specified ports.
A RealSystem component uses the following interface to access Network Services:
IRMANetworkServices
. Header file: rmaengin.h
. RealSystem implements this interface, which RealSystem components use to generate network socket interfaces.
A RealSystem component implements the following asynchronous response interfaces to use Network Services:
IRMAListenResponse
. Header file: rmaengin.h
. This response interface to IRMAListenSocket
lets the component receive information about TCP connections on a port.
IRMAResolverResponse
. Header file: rmaengin.h
. This response interface to IRMAResolver
lets the component resolve host names.
IRMATCPResponse
. Header file: rmaengin.h
. The RealSystem component implements this response interface to IRMATCPSocket
if it needs to create a TCP socket.
IRMAUDPResponse
. Header file: rmaengin.h
. The RealSystem component implements this response interface to IRMAUDPSocket
if it needs to create a UDP socket.
Network Services also includes the following platform-specific interface:
IRMAAsyncIOSelection
. Header file: rmaengin.h
. Implemented by RealSystem, this interface lets UNIX components receive callbacks through IRMACallback
based on I/O events normally handled by select()
.
A RealSystem component does the following to set up a TCP listening socket and receive notice of a TCP connection on a local port:
IRMANetworkServices::CreateListenSocket
and receives a pointer to the new socket interface.
IRMAListenSocket::Init
on the socket interface to identify itself as the response interface. This method also passes the local IP address and port number on which to listen.
IRMATCPSocket
interface and calls the component's IRMAListenResponse::NewConnection
method, which returns a status code and a pointer to the TCP socket interface. The component can then use the TCP socket methods described below.
![]() |
Additional Information |
---|
See "Status Codes". |
A RealSystem component can create or inherit an existing TCP socket:
IRMANetworkServices::CreateTCPSocket
and receives a pointer to the new socket interface. The component then calls IRMATCPSocket::Init
to initialize the socket and identify itself as the response interface.
IRMATCPSocket::SetResponse
to identify itself as the response interface. It can also use the following IRMATCPSocket
methods to return in local host order the addresses and ports of the TCP socket:
After it has set up the TCP socket, the component can perform the following actions:
IRMATCPSocket::Bind
to bind the TCP socket to a local address and port. It specifies the port and address in native byte order.
IRMATCPSocket::Connect
, passing a host name in the form www.myserver.com
or an IP address in the form nnn.nnn.nnn.nnn
. RealSystem then returns a status code through IRMATCPResponse::ConnectDone
.
![]() |
Additional Information |
---|
See "Status Codes". |
IRMATCPSocket::Read
to read the specified number of bytes from the TCP source. Through IRMATCPResponse::ReadDone
the system returns a status code and a pointer to an IRMABuffer
interface containing the data.
IRMATCPSocket::Write
, which passes Network Services a pointer to an IRMABuffer
interface.
![]() |
Note |
---|
To write a large amount of data (more than 500 Kbps, approximately),
the component should first call IRMATCPSocket::WantWrite . When the
channel is ready to write the data, the TCP interface returns a status code
with IRMATCPResponse::WriteReady .
|
To use a UDP socket, an object calls IRMANetworkServices::CreateUDPSocket
and receives a pointer to the new socket interface. It then calls IRMAUDPSocket::Init
to initialize the socket and identify itself as the response interface. This method also passes the IP connection address as a four-byte address in native byte order. (The component can use the resolver to get this address.) After it has set up the UDP socket, the component can perform the following actions with it (note that all addresses are in native byte order):
IRMAUDPSocket::GetLocalPort
to retrieve the local port and IRMAUDPSocket::Bind
to bind the UDP socket to a local address and port.
IRMAUDPSocket::Read
to read a specified number of bytes from the UDP source. The UDP interface uses IRMAUDPResponse::ReadDone
to return a status code, the local address, the local port, and a pointer to an IRMABuffer
interface containing the data.
![]() |
Additional Information |
---|
See "Status Codes". |
IRMAUDPSocket::Write
, which passes a pointer to an IRMABuffer
interface. The component can also write to a different UDP address with IRMAUDPSocket::WriteTo
, which specifies an address and a port as it passes the IRMABuffer
pointer.
IRMAUDPSocket::JoinMulticastGroup
, specifying the multicast address (the address it is sending to) and the interface address (the address it is sending from). It uses IRMAUDPSocket::LeaveMulticastGroup
to leave the multicast.
A RealSystem component does the following to get the IP address for a DNS host name:
IRMANetworkServices::CreateResolver
and receives a pointer to the new resolver interface.
IRMAResolver::Init
to identify itself as the response interface.
IRMAResolver::GetHostByName
, passing RealSystem a DNS name in the form www.myserver.com
. The system responds with IRMAResolverResponse::GetHostByNameDone
, which returns a status code and a four-byte IP address in native byte order.
![]() |
Additional Information |
---|
See "Status Codes". |
On UNIX, RealSystem (RealServer or client) handles I/O events through the UNIX select()
function. UNIX plug-ins do not have access to this function directly. If a plug-in needs to handle an I/O event, it sets up a callback through which RealSystem informs it that a specified file descriptor is ready for reading or writing, or has an exception:
IRMACallback
.
IRMAAsyncIOSelection::Add
, identifying itself as the callback interface and passing the system the file descriptor and type.
IRMACallback::Func
.
IRMACallback::Func
, the plug-in handles the event as necessary.
IRMAAsyncIOSelection::Remove
.