sndremote.c

来自「unix 下用pro*c tuxedo 开发的东西」· C语言 代码 · 共 74 行

C
74
字号
/*
 * BANKING TRANSACTION SWITCHING SYSTEM (version 1.0).
 *
 * (C) COPYRIGHT International Business Machines Corp. 1997
 * All Rights Reserved
 * Licensed Materials - Property of IBM
 */

/*
 ***************************************************************************
 * (1)  File Name      : sndremote.c                                       *
 * (2)  Module ID      :                                                   *
 * (3)  Module Name    : Send message to remote monitor module.            *
 *                                                                         *
 * (4)  Purpose        : 1. Initialize the object for remote communication.*
 *                       2. Send a byte string to remote monitor.          *
 *                       3. Close the object for remote communication.     *
 *                                                                         *
 * (5)  Author         : Chen Li (IBM China)                               *
 * (6)  Date Created   : 1997/06/01                                        *
 * (7)  Version        : 1.0                                               *
 * (8)  Environment    : AIX 4.x                                           *
 * (9)  Warnings       :                                                   *
 ***************************************************************************
 * (10) Changed Logs   :                                                   *
 *      Change No.   Date          Author          Reason For Change       *
 *                                                                         *
 ***************************************************************************
 */


#include <stdio.h>
#include <stdlib.h>

#include "udp_send.h"

int initFlag = 0;

int InitRemoteCommObj()
{
    int ret; 
    int fn[1024];
    char *p;   

    p = getenv("HOME");
    strcpy(fn, p);
    strcat(fn, "/etc/remotenet.data");
   
    ret = ReadNetCfgFile(fn);
    if (ret < 0)
        return -1;

    ret = UDP_Init();
    if (ret < 0)
        return -2; 

    initFlag = 1;
    return 0;
}

int SendToRemote(int netid, const unsigned char* msg, int len)
{
    if (initFlag == 0)
        return -1;
    return(SysBoraccastToNet(netid-1, msg, len));
}

int CloseRemoteCommObj()
{
    UDP_Close();
    initFlag = 0;
    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?