This is archived documentation for an older version of Nirvana (v3.1). Please refer to documentation for the latest version if required.

Nirvana Peer to Peer Examples

Example 1 - Stream Joiner Service

Company A has a 3rd party information system with a client component that allows users to query it and obtain information. This system is socket based and runs on port 10000.

Company B uses the same 3rd party information system but needs to query the information owned by company A.

There is no physical network link between company A and company B, and therefore no means for users in company B to use the 3rd party client application and connect to company A's information system.

By using Nirvana Peer to Peer services, this can however be achieved.

How?

Company A writes a Server Service that runs internally behind their firewall. When it runs, it connects to a realm that is running on a server somewhere that is visbile to external clients, say within the DMZ (de-militarized zone) or an external hosting service. When connections are established via the realm from a client at company B, the server service simply creates a socket connection to the 3rd party application. From this socket connection, the service can then join the input stream from the copmany B connection to the output stream of the 3rd party software connection. It can also join the input stream of the 3rd party sofware system connection to the output stream of the company B connection.

Company B writes a simple Java server socket program that runs on port 10000 like the 3rd party information system run by both companies. This program runs internally within company B. When any connections are established from the 3rd party client application to the Java server socket, the program creates a connection to the same Nirvana realm used by the server service at company A, locates the service, connects to it and gets a reference to the client service. It can then join the input stream from the 3rd party app connection to the output stream of the service, and join the input stream of the service to the output stream of the 3rd party aplication.

So users of the 3rd party client application in company B will be receiving information as if it was coming from their own system, whereas in fact it is coming from company A via the Nirvana Realm and simple joined streams from a Peer to Peer service.

Remember all communication between client and server services, input and output streams goes via a Nirvana Realm, and so any firewalls, proxy servers deployed by either company A or company B can be traversed using Nirvana's HTTP or HTTPS wire protocols.