©2004 by Marc J. Rochkind. All rights reserved. Portions marked "Open Source" may be copied under license.

 

Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

c7/smsg_server_smi_a.c

Go to the documentation of this file.
00001 /*
00002     SMI-based server
00003     AUP2, Sec. 7.03.2
00004 
00005     Copyright 2003 by Marc J. Rochkind. All rights reserved.
00006     May be copied only for purposes and under conditions described
00007     on the Web page www.basepath.com/aup/copyright.htm.
00008 
00009     The Example Files are provided "as is," without any warranty;
00010     without even the implied warranty of merchantability or fitness
00011     for a particular purpose. The author and his publisher are not
00012     responsible for any damages, direct or incidental, resulting
00013     from the use or non-use of these Example Files.
00014 
00015     The Example Files may contain defects, and some contain deliberate
00016     coding mistakes that were included for educational reasons.
00017     You are responsible for determining if and how the Example Files
00018     are to be used.
00019 
00020 */
00021 #include "defs.h"
00022 #include "smsg_smi.h"
00023 
00024 /* Server */
00025 
00026 /*[main]*/
00027 int main(void)
00028 {
00029     SMIQ *sqp;
00030     struct smi_msg *msg_in, *msg_out;
00031     int i;
00032 
00033     printf("server started\n");
00034     ec_null( sqp = smi_open(SERVER_NAME, SMI_SERVER, DATA_SIZE) )
00035     while (true) {
00036         ec_false( smi_receive_getaddr(sqp, (void **)&msg_in) )
00037         ec_false( smi_send_getaddr(sqp, &msg_in->smi_client,
00038           (void **)&msg_out) )
00039         for (i = 0; msg_in->smi_data[i] != '\0'; i++)
00040             msg_out->smi_data[i] = toupper(msg_in->smi_data[i]);
00041         msg_out->smi_data[i] = '\0';
00042         ec_false( smi_receive_release(sqp) )
00043         ec_false( smi_send_release(sqp) )
00044     }
00045     /* never actually get here */
00046     ec_false( smi_close(sqp) )
00047     exit(EXIT_SUCCESS);
00048 
00049 EC_CLEANUP_BGN
00050     exit(EXIT_FAILURE);
00051 EC_CLEANUP_END
00052 }

Generated on Fri Apr 23 10:57:01 2004 for AUP2 Example Source by doxygen 1.3.1