Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

rawapigsin.c

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 /********************************************************************
00017  * Copyright:
00018  *   GSI, Gesellschaft fuer Schwerionenforschung mbH
00019  *   Planckstr. 1
00020  *   D-64291 Darmstadt
00021  *   Germany
00022  * created 19. 3.2001 by Horst Goeringer
00023  ********************************************************************
00024  * rawapigsin.c
00025  *   GSI extensions for tsmcli client API (RFIO syntax)
00026  ********************************************************************
00027  * 19. 3.2001, H.G.: rfio_gsi_disconnect added
00028  *  3. 2.2003, H.G.: created from rawapigsi.c
00029  ********************************************************************
00030  */
00031 
00032 #include <stdio.h>
00033 
00034 #ifdef WIN32
00035 #include <winsock.h>
00036 #else
00037 #include <sys/socket.h>
00038 #endif
00039 
00040 #include "rawcommn.h"
00041 #include "rawapigsi.h"
00042 #include "rawentn.h"
00043 
00044 static int iint = sizeof(int);
00045 FILE *fLogFile;
00046 
00047 /*********************************************************************
00048  * rfio_gsi_disconnect.c
00049  *    close connection to specified server
00050  *********************************************************************
00051  */
00052 
00053 int rfio_gsi_disconnect(int iSocket)               /* socket number */
00054 {
00055    char cModule[32] = "rfio_gsi_disconnect";
00056    int iDebug = 0;
00057    int iRC = 0;
00058    int iStatus = STA_END_OF_SESSION;
00059 
00060    if (iSocket)
00061    {
00062       /* stop server process */
00063       iRC = rawSendStatus(iSocket, iStatus, NULL);
00064       if (iRC <= 0)
00065          printf("-E- sending status buffer (EOS)\n");
00066       else if (iDebug)
00067          printf("-D- status buffer (EOS) sent (%d bytes)\n", iRC);
00068 
00069       if (iDebug)
00070          printf("    close connection %d\n", iSocket);
00071       iRC = shutdown(iSocket, 2);
00072       if (iDebug)
00073          printf("    rc shutdown = %d\n", iRC);
00074       iRC = close(iSocket);
00075       if (iDebug)
00076          printf("    rc close = %d\n", iRC);
00077 
00078       return 0;
00079    }
00080 
00081    printf("-E- %s: invalid socket number specified: %d\n",
00082           cModule, iSocket);
00083    return -1;
00084 
00085 } /* end rfio_gsi_disconnect */
00086 
00087 
00088 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:34 2008 for Go4-v3.04-1 by  doxygen 1.4.2