00001 //--------------------------------------------------------------- 00002 // Go4 Release Package v2.10-5 (build 21005) 00003 // 03-Nov-2005 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at DVEE 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 #include "rawcommn.h" 00035 #include "rawapigsi.h" 00036 #include "rawentn.h" 00037 00038 static int iint = sizeof(int); 00039 FILE *fLogFile; 00040 00041 /********************************************************************* 00042 * rfio_gsi_disconnect.c 00043 * close connection to specified server 00044 ********************************************************************* 00045 */ 00046 00047 int rfio_gsi_disconnect(int iSocket) /* socket number */ 00048 { 00049 char cModule[32] = "rfio_gsi_disconnect"; 00050 int iDebug = 0; 00051 int iRC = 0; 00052 int iStatus = STA_END_OF_SESSION; 00053 00054 if (iSocket) 00055 { 00056 /* stop server process */ 00057 iRC = rawSendStatus(iSocket, iStatus, NULL); 00058 if (iRC <= 0) 00059 printf("-E- sending status buffer (EOS)\n"); 00060 else if (iDebug) 00061 printf("-D- status buffer (EOS) sent (%d bytes)\n", iRC); 00062 00063 if (iDebug) 00064 printf(" close connection %d\n", iSocket); 00065 iRC = shutdown(iSocket, 2); 00066 if (iDebug) 00067 printf(" rc shutdown = %d\n", iRC); 00068 iRC = close(iSocket); 00069 if (iDebug) 00070 printf(" rc close = %d\n", iRC); 00071 00072 return 0; 00073 } 00074 00075 printf("-E- %s: invalid socket number specified: %d\n", 00076 cModule, iSocket); 00077 return -1; 00078 00079 } /* end rfio_gsi_disconnect */ 00080 00081 00082 //----------------------------END OF GO4 SOURCE FILE ---------------------