[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::decc

Title:DECC
Notice:General DEC C discussions
Moderator:TLE::D_SMITHNTE
Created:Fri Nov 13 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2212
Total number of notes:11045

2175.0. "Client-Server Appli on VMS" by SEGUR::KUOCH () Mon May 05 1997 09:35

    A customer trys to port a client-server application from PC <-> UNIX to 
    PC <-> VMS :
    
    		  +--------------+
    PC <--------> | DIGITAL UNIX |
    		  |              |
    PC <--------> |              |
    ...		  |		 |
    		  +--------------+

    On DIGITAL UNIX, the server do the following functions :

    socket, bind, listen, accept, then for each connection from PC, creates
    a child process with fork and read/write with PC, the mother process
    continue to loops on accept to wait for other PC connection.
    (The port number is always the same) 

    On PC, the application asks for the server TCP/IP address and port number,
    then it connects to the DIGITAL UNIX server. 

    My question is : 
    	On VMS, if a subprocess is created with vfork for each connection
    	request from PC, the subprocess does not inherit the mother process's
    	socket environment, and it can not read/write with the PC.

    	If I don't create subprocess, only one process for all connected PC :
    	it seems a little complicated, in case of several PC connect on the
    	"same" time.

    	Generally, on VMS, how a server application is designed ?
    	Do you have any suggestion ?
    	 
    The customer doesn't like to modify the PC client application.

    Thank you in advance.

    Regards.
    Cheu.
T.RTitleUserPersonal
Name
DateLines
2175.1Options...XDELTA::HOFFMANSteve, OpenVMS EngineeringMon May 05 1997 11:3353
   The client-server questions are either UCX or OpenVMS questions, and
   are not specifically DEC C questions.

   If no changes can be made to the PC package: use DECthreads, or similar,
   to keep multiple threads operating in the OpenVMS server.  With OpenVMS
   Alpha V7+) kernel threads support, these threads can operate across
   multiple processors in an SMP system, and are a very close analog to the
   forked processes of UNIX.  DECthreads includes a pthreads API, which is
   portable across multiple operating system platforms.  (As for ways to
   "bypass" the deliberate interlocks against accessing a socket across
   multiple processes or to "hand off" these connections, if any, please
   ask the UCX folks.)

   If a few changes can be made to the PC package: code the OpenVMS and UNIX
   hosts as the "directory servers", located via DNS or similar, and have
   the "directory servers" redirect the request to the appropriate target. 
   (This adds one big benefit for OpenVMS, UNIX and NT: one can bring
   multiple hosts to bear on the problem, adding hosts and host CPUs
   incrementally.)

   I haven't written a monolithic client-server process application for
   some number of years -- I learned early on to distribute specific tasks
   across the network -- to split out tasks such as "directory services",
   "user interface clients", application-specific server tasks, "logger
   tasks", "debugger tasks", "process manager", and such.
   
   One of the key tasks here is the "directory services" task -- this
   task is used to locate available server components, and potentially
   to indicate to the logger task and the process manager that additional
   servers are needed -- this task allows the user interface client -- a
   PC or other client interface -- to locate an available server most
   anywhere in the local network. 

   Using this "division of labor" design, one avoids many of the problems
   the monolithic design will encounter.  And the division of labor means
   that one can take ready advantage of OpenVMS distributed lock manager
   in a VMScluster for interprocess control and journaling, etc, just as
   one could divide up the tasks to take advantage of something easily
   performed under NT or UNIX.

   As should be obvious, the above "division of labor" design uses both
   TCP and UDP datagrams, with UDP providing the bulk of the "one-shot"
   message transport communications and TCP providing the bulk of large
   point-to-point transfers.  (Connectionless transports such as UDP may
   require a software layer to perform simple-minded retries and such,
   and one can use UDP messages to send one message to multiple targets.
   TCP operates better when more reliability is required, and when one
   needs to send a number of messages between two target tasks.  UDP is,
   however, surprisingly reliable even without a "retries" layer.)

   DECmessageQ is/was one package in this area.  There are others.

2175.2SPECXN::DERAMODan D&#039;EramoMon May 05 1997 12:469
        One approach that can be used with UCX on OpenVMS is to use a
        UCX auxiliary server.  This is a setup in which UCX listens on
        the given port and creates a new process to handle each
        connection that arrives.  The bind/listen/accept calls are
        removed from the server code -- UCX handles that -- each
        process created by user uses special arguments to socket()
        to get the socket descriptor for the connection to its client.
        
        Dan
2175.3TLE::D_SMITHDuane Smith -- DEC C RTLTue May 06 1997 08:1912
    One other note.  As of OpenVMS V7.0, sockets are inherited by child
    processes.  This change has not been included in any ECO kits for
    earlier versions for fear that ISV's would now have two sockets open in
    each child process after having worked around the deficiency.
    
    You may consider using the DECC$CRTL.OLB backport object library made
    available on the DEC C V5.6 compiler kits.  This library is equivalent
    to that functionality shipping on OpenVMS V7.1.  Three files are placed
    in SYS$LIBRARY, one being DECC$CRTL.README containing instructions on
    how to use the backport object library.
    
    Duane