Gateway applications

An Open Server application that acts as both a client and a server is called a gateway application. Gateway applications often act as intermediaries for clients and servers that cannot communicate directly.

For example, an Open Client application cannot communicate directly with an Oracle database engine, but the client application can communicate with an Open Server application that serves as a gateway to the Oracle database. In this case, the gateway acts as a server to the Open Client application and as a client to the Oracle database engine.

Another case is when a client cannot directly access a remote Adaptive Server because the two are running on dissimilar networks. The gateway server bridges this gap, retrieving the client data and repackaging it to send to the remote Adaptive Server. Sybase’s mirror-image client and server routines simplify this process. The server and client components can even share the same data description structure; the gateway fills in a structure with information from the remote client using Server-Library calls and then extracts that same information from the structure to send along to the remote server using Client-Library or DB-Library calls.

Gateways that act as clients to a Adaptive Server or to an Open Server application use Client-Library or DB-Library routines to fill the client role that they play.

Gateways that act as servers to Open Client applications use Server-Library routines to fill the server role that they play.

WARNING! Client-Library cannot be run in full asynchronous mode in an Open Server application.

The sample program ctos.c is an example of a “virtual Adaptive Server” gateway. The gateway demonstrates how to pass data from a remote Adaptive Server to a Sybase client.

WARNING! In gateway applications, the client routines execute in the context of an Open Server process, or thread. If this process (or the entire Open Server application) is terminated, any client routines that are executing will yield undefined results.