예제 #1
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_tcpsend_process, ev, data)
{
  char *next;
  const char *dummy; 
  struct shell_input *input;
  uint16_t port;
  
  PROCESS_BEGIN();

  next = strchr(data, ' ');
  if(next == NULL) {
    shell_output_str(&tcpsend_command,
		     "tcpsend <server> <port>: server as address", "");
    PROCESS_EXIT();
  }
  *next = 0;
  ++next;
  strncpy(server, data, sizeof(server));
  port = shell_strtolong(next, &dummy);
  
  running = 1;

  uiplib_ipaddrconv(server, &serveraddr);
  telnet_connect(&s, &serveraddr, port);
  while(running) {
    PROCESS_WAIT_EVENT();

    if(ev == shell_event_input) {
      input = data;
      if(input->len1 + input->len2 == 0) {
	PROCESS_EXIT();
      }

      if(input->len1 > 0) {
	send_line(&s, input->data1, input->len1);
      }
    } else if(ev == tcpip_event) {
      telnet_app(data);
#if 0            
    } else if(ev == resolv_event_found) {
      /* Either found a hostname, or not. */
      if((char *)data != NULL &&
	 resolv_lookup((char *)data) != NULL) {
	uip_ipaddr_copy(serveraddr, ipaddr);
	telnet_connect(&s, server, serveraddr, nick);
      } else {
	shell_output_str(&tcpsend_command, "Host not found.", "");
      }
#endif /* 0 */
    }
  }

  PROCESS_END();
}
예제 #2
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_udpsend_process, ev, data)
{
  const char *next, *nextptr;
  struct shell_input *input;
  uint16_t port, local_port;
  
  PROCESS_BEGIN();

  next = strchr(data, ' ');
  if(next == NULL) {
    shell_output_str(&udpsend_command,
		     "udpsend <server> <port> [localport]: server as address", "");
    PROCESS_EXIT();
  }
  ++next;
  strncpy(server, data, sizeof(server));
  port = shell_strtolong(next, &nextptr);

  uiplib_ipaddrconv(server, (u8_t *)&serveraddr);
  udpconn = udp_new(&serveraddr, htons(port), NULL);
  
  if(next != nextptr) {
    local_port = shell_strtolong(nextptr, &nextptr);
    udp_bind(udpconn, htons(local_port));
  }
  running = 1;


  while(running) {
    PROCESS_WAIT_EVENT();

    if(ev == shell_event_input) {
      input = data;
      if(input->len1 + input->len2 == 0) {
	PROCESS_EXIT();
      }

      if(input->len1 > 0) {
	send_line(input->data1, input->len1);
      }
    } else if(ev == tcpip_event) {
      if(uip_newdata()) {
	newdata(uip_appdata, uip_datalen());
      }
#if 0
    } else if(ev == resolv_event_found) {
      /* Either found a hostname, or not. */
      if((char *)data != NULL &&
	 resolv_lookup((char *)data) != NULL) {
	uip_ipaddr_copy(serveraddr, ipaddr);
	telnet_connect(&s, server, serveraddr, nick);
      } else {
	shell_output_str(&udpsend_command, "Host not found.", "");
      }
#endif /* 0 */
    }
  }

  PROCESS_END();
}
예제 #3
0
void telnet_start(){
	if (telnet_socket == 0)
        telnet_connect();

    if (pthread_create(&telnet_thr, NULL, telnet_read, NULL) != 0) {
        perror("Telnet Pthread");
        exit(-1);
    }   
}
예제 #4
0
int SVUnixOpMonitor::telnetOpen()
{
	int nResult;

	nResult=telnetinit();
	if(SVFAILED(nResult)) return nResult;
	for(int nLoop=0;nLoop<2;nLoop++  )
	{
		nResult=telnet_connect();

		if(!SVFAILED(nResult)) break;
	}
	if(SVFAILED(nResult)) return nResult;
	/*
	nResult=telnet_command();
	if(SVFAILED(nResult)) return nResult;*/
	return TELNETSUCCESS;

}
예제 #5
0
파일: worlds.c 프로젝트: nowl/mudc
static void
dialog_response(GtkWidget *dialog,
                gint response_id,
                gpointer user_data)
{
    switch(response_id)
    {
    case CONNECT_TO_WORLD:
    {
        GtkWidget *tree = user_data;
        GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
        GList *selected_rows = gtk_tree_selection_get_selected_rows(selection, NULL);

        GtkTreePath *path = selected_rows->data;
        //gint *path_ind = gtk_tree_path_get_indices(path);
        GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));
        GtkTreeIter iter;
        gtk_tree_model_get_iter(model, &iter, path);
        GValue hostname_value = {0};
        GValue port_value = {0};
        gtk_tree_model_get_value(model, &iter, WORLD_HOSTNAME, &hostname_value);
        gtk_tree_model_get_value(model, &iter, WORLD_PORT, &port_value);

        char *hostname = strdup(g_value_get_string(&hostname_value));
        unsigned short port = g_value_get_int(&port_value);

        g_value_unset(&hostname_value);
        g_value_unset(&port_value);

        /* save off old tab_completion file */
        tab_complete_save();

        /* set up the tab completion file */
        char *home_dir = getenv("HOME");
        int len = strlen(home_dir) + MAX_LINE_LEN + 18 + 1;
        char *tab_complete_name = malloc(sizeof(*tab_complete_name) * len);

        /* create each level of the directory structure since a -p
         * type option doesn't exist AFAIK  */
        snprintf(tab_complete_name, len, "%s/.mudc/worlds/%s", home_dir, hostname);
        mkdir(tab_complete_name, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
        snprintf(tab_complete_name, len, "%s/.mudc/worlds/%s/tab", home_dir, hostname);
        FILE *tmp_file = fopen(tab_complete_name, "r");
        if( !tmp_file )
            tmp_file = fopen(tab_complete_name, "w");
        fclose(tmp_file);

        tab_complete_set_wordlist_file(tab_complete_name);

        /* load macro definitions */
        len = strlen(home_dir) + MAX_LINE_LEN + 21 + 1;
        char *macros_filename = malloc(sizeof(*macros_filename) * len);
        snprintf(macros_filename, len, "%s/.mudc/worlds/%s/macros", home_dir, hostname);
        tmp_file = fopen(tab_complete_name, "r");
        if( !tmp_file )
            tmp_file = fopen(tab_complete_name, "w");
        fclose(tmp_file);

        macros_load(macros_filename);

        /* disconnect from current telnet connection */
        telnet_close(MUDC.telnet);
        MUDC.telnet = NULL;

        /* clear text buffer */
        GtkTextIter start, end;
        gtk_text_buffer_get_start_iter(MUDC.widgets.text_buffer, &start);
        gtk_text_buffer_get_end_iter(MUDC.widgets.text_buffer, &end);
        gtk_text_buffer_delete(MUDC.widgets.text_buffer, &start, &end);

        /* fire up the telnet connection */
        MUDC.telnet = telnet_connect(hostname, port);

        if(MUDC.telnet == NULL)
        {
            GtkWidget * dialog2 = gtk_message_dialog_new(GTK_WINDOW(dialog),
                                  GTK_DIALOG_DESTROY_WITH_PARENT,
                                  GTK_MESSAGE_ERROR,
                                  GTK_BUTTONS_CLOSE,
                                  "Error connecting to %s:%d",
                                  hostname, port);
            gtk_dialog_run(GTK_DIALOG(dialog2));
            gtk_widget_destroy(dialog2);
        }

        free(hostname);

        gtk_widget_destroy(dialog);

        break;
    }
    case ADD_WORLD:
    {
        GtkWidget *dialog2 = gtk_dialog_new_with_buttons("Add World",
                             GTK_WINDOW(MUDC.widgets.main_window),
                             GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                             "Add", ADD_WORLD,
                             "Cancel", CANCEL,
                             NULL);

        gtk_window_set_default_size(GTK_WINDOW(dialog2), 320, 200);

        GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog2));

        GtkWidget *ts1 = gtk_table_new(3, 2, FALSE);
        gtk_table_set_row_spacings(GTK_TABLE(ts1), 10);
        gtk_table_set_col_spacings(GTK_TABLE(ts1), 10);
        gtk_box_pack_start(GTK_BOX(content_area), ts1, TRUE, FALSE, 0);

        gtk_table_attach_defaults(GTK_TABLE(ts1), gtk_label_new("World Name"), 0, 1, 0, 1);
        gtk_table_attach_defaults(GTK_TABLE(ts1), gtk_label_new("Hostname"), 0, 1, 1, 2);
        gtk_table_attach_defaults(GTK_TABLE(ts1), gtk_label_new("Port"), 0, 1, 2, 3);

        GtkWidget *name_entry = gtk_entry_new();
        gtk_table_attach_defaults(GTK_TABLE(ts1), name_entry, 1, 2, 0, 1);
        GtkWidget *hostname_entry = gtk_entry_new();
        gtk_table_attach_defaults(GTK_TABLE(ts1), hostname_entry, 1, 2, 1, 2);
        GtkWidget *port_entry = gtk_entry_new();
        gtk_table_attach_defaults(GTK_TABLE(ts1), port_entry, 1, 2, 2, 3);

        GtkWidget *widgets[] = {user_data, name_entry, hostname_entry, port_entry};

        g_signal_connect(dialog2, "response",
                         G_CALLBACK(add_world_response),
                         widgets);

        gtk_widget_show_all(dialog2);
        gtk_dialog_run(GTK_DIALOG(dialog2));
        gtk_widget_destroy(dialog2);

        break;
    }
    case REMOVE_WORLD:
    {
        GtkWidget *tree = user_data;
        GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
        GList *selected_rows = gtk_tree_selection_get_selected_rows(selection, NULL);

        GtkTreePath *path = selected_rows->data;
        GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));
        GtkTreeIter iter;
        gtk_tree_model_get_iter(model, &iter, path);
        gtk_list_store_remove(GTK_LIST_STORE(model), &iter);

        write_to_config(GTK_LIST_STORE(model));

        break;
    }
    };
}
예제 #6
0
BOOL TELCLUSTER_MONITOR(char *server, int port, char *uid, char *pwd, char *pserver,
                        int pport, char *puid, char *ppwd, char *lprompt, char *pprompt, char *prompts,
                        char *ostype, char *clusterlog, char *cpath, char *szReturn)
{
    int		ret = 0;
    int		hSocket = 0;
    BOOL	bResult = TRUE;
    char	iniFile[256] = {0};
    char	cmd[256] = {0};

    /*************************************
     * For Reason Of Prompt
     */
    int		c = 0;
    char	*ca = prompts, *cb = NULL;
    char	arprompt[PR_NUM][256];
    memset(arprompt, 0, sizeof(arprompt));

    LPGDATA pgd=new GDATA;
    memset(pgd,0,sizeof(GDATA));

    while(cb = strchr(ca, 0x20))
    {
        if(ca == cb)
        {
            ca ++;
            continue;
        }

        strncpy(arprompt[c++], ca, cb - ca);
        ca = cb + 1;
    }

    strcpy(arprompt[c++], ca);
    /***********************************/

    hSocket = telnet_init(server, port, pserver, pport, puid, ppwd);
    if(hSocket <= 0)
    {
        if(hSocket == -1)
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_1%>"));    //  <%IDS_TelMonitor_1%>
        else if(hSocket == -2)
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_2%>"));   //  <%IDS_TelMonitor_2%>
        else if(hSocket == -3)
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_3%>"));     //  <%IDS_TelMonitor_3%>
        else if(hSocket == -4)
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_4%>"));     //  <%IDS_TelMonitor_4%>
        else if(hSocket == -5)
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_5%>"));        //  <%IDS_TelMonitor_5%>
        else
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_6%>"));     //  <%IDS_TelMonitor_6%>

        bResult = FALSE;
        goto err;
    }

    if((ret = telnet_connect(hSocket, uid, pwd, lprompt, pprompt, arprompt,pgd)) < 0)
    {
        if(ret == -1)
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_7%>"));    //  <%IDS_TelMonitor_7%>
        else if(ret == -2)
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_8%>"));     //  <%IDS_TelMonitor_8%>
        else if(ret == -3)
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_9%>"));     //  <%IDS_TelMonitor_9%>
        else if(ret == -4)
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_10%>"));   //  <%IDS_TelMonitor_10%>
        else if(ret == -5)
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_11%>"));   //  <%IDS_TelMonitor_11%>
        else if(ret == -6)
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_12%>"));   //  <%IDS_TelMonitor_12%>
        else
            sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_13%>"));     //  <%IDS_TelMonitor_13%>

        bResult = FALSE;
        goto err;

    }
#if _DEBUG
    sprintf(iniFile, "%s\\templates.os\\%s", FuncGetInstallRootPath(), ostype);
#else
    sprintf(iniFile, "%s\\MonitorManager\\templates.os\\%s", FuncGetInstallRootPath(), ostype);
#endif
    DFN_GetPrivateProfileString("cat", "command", "", cmd, sizeof(cmd), iniFile);
    if(!*cmd)
    {
        sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_14%>"));    //  <%IDS_TelMonitor_14%>
        bResult = FALSE;
        goto err;
    }

    if(ca = strstr(cmd, "<file>"))
    {
        strcpy(ca, clusterlog);
        *(ca + strlen(clusterlog)) = 0;
    }

    if((ret = telnet_command(hSocket, cmd,pgd)) < 0)
    {
        sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_15%>"));    //  <%IDS_TelMonitor_15%>
        bResult = FALSE;
        goto err;
    }

    {
        int index = 0;
        CString	strBuffer(pgd->databuffer);
        CString	strLine = _T("");

        // Cluster
        if((index = strBuffer.Find("CLUSTER", 0)) >= 0)
        {
            strBuffer.Delete(0, index);
        }
        else
        {
            sprintf(szReturn, "error=%s", "No Cluster");	// No Cluster
            bResult = FALSE;
            goto err;
        }

        strLine = GetStringFromLineNo(strBuffer, 2);
        sprintf(szReturn, "%sClusterName=%s$ClusterStatus=%s$", szReturn,
                GetColumnFromLine(strLine, 1), GetColumnFromLine(strLine, 2));

        // Node
        if((index = strBuffer.Find("NODE", 0)) >= 0)
        {
            strBuffer.Delete(0, index);
        }
        else
        {
            sprintf(szReturn, "error=%s", "No Node");	// No Node
            bResult = FALSE;
            goto err;
        }

        strLine = GetStringFromLineNo(strBuffer, 2);
        sprintf(szReturn, "%sNodeName=%s$NodeStatus=%s$NodeState=%s$", szReturn,
                GetColumnFromLine(strLine, 1), GetColumnFromLine(strLine, 2),
                GetColumnFromLine(strLine, 3));

        // Package
        if((index = strBuffer.Find("PACKAGE", 0)) >= 0)
        {
            strBuffer.Delete(0, index);
        }
        else
        {
            sprintf(szReturn, "error=%s", "No Package");	// No Package
            bResult = FALSE;
            goto err;
        }

        strLine = GetStringFromLineNo(strBuffer, 2);
        sprintf(szReturn, "%sPackageName=%s$PackageStatus=%s$PackageState=%s$PackageAutorun=%s$",
                szReturn, GetColumnFromLine(strLine, 1), GetColumnFromLine(strLine, 2),
                GetColumnFromLine(strLine, 3), GetColumnFromLine(strLine, 4));
    }

err:
    shutdown(hSocket, 0x02);
    closesocket(hSocket);
    delete pgd;
    return bResult;
}
예제 #7
0
bool AIXERRPT_TEL_VALUE(char *server, int port, char *uid, char *pwd, 
						char *pserver, int pport, char *puid, char *ppwd, 
						char *lprom, char *pprom, char *prom, char *inifile, 
						int ngid, char* strmid, char *custpath, char *szReturn)
{

	int		ret = 0;
	int		hSocket = 0;
	bool	bResult = TRUE;
	char	buffer[256] = {0};
	char	mbuffer[256] = {0};
	char	mdate[256] = {0};
	char	datebuff[64] = {0};
	char	curdate[64] = {0};
	//char	szIniFile[256] = {0};
	char	szTmpIniFile[256] = {0};
	int		isChinese = 0;

	//puts("ok");
	/*************************************
	 * For Reason Of Prompt
	 */
	int		c = 0;
	char	*ca = prom, *cb = NULL;
	char	arprompt[PR_NUM][256];
	memset(arprompt, 0, sizeof(arprompt));

	LPGDATA pgd=new GDATA;
	memset(pgd,0,sizeof(GDATA));


	while(cb = strchr(ca, 0x20))
	{
		if(ca == cb) 
		{
			ca ++;
			continue;
		}

		strncpy(arprompt[c++], ca, cb - ca);
		ca = cb + 1;
	}

	strcpy(arprompt[c++], ca);
	/***********************************/

	hSocket = telnet_init(server, port, pserver, pport, puid, ppwd);
	if(hSocket <= 0)
	{
		if(hSocket == -1)
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_MQ_1%>"));//<%IDS_MQ_1%>"连接失败:域名解析"
		else if(hSocket == -2)
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_MQ_2%>"));//<%IDS_MQ_2%>"连接失败:通信初始化"
		else if(hSocket == -3)
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_MQ_3%>"));//<%IDS_MQ_3%>"连接失败:连接超时"
		else if(hSocket == -4)
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_MQ_4%>"));//<%IDS_MQ_4%>"代理服务器连接失败"
		else if(hSocket == -5)
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_MQ_5%>"));//<%IDS_MQ_5%>"代理服务器错误"
		else 
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_MQ_6%>"));//<%IDS_MQ_6%>"连接失败:未知错误"

		bResult = FALSE;
		goto err;
	}

	Tel_Param param;
	if((ret = telnet_connect(hSocket, uid, pwd, lprom, pprom, arprompt,pgd,&param)) < 0)
	{
		if(ret == -1)
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_MQ_7%>"));//<%IDS_MQ_7%>"登录失败:读数据超时"
		else if(ret == -2)
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_MQ_8%>"));//<%IDS_MQ_8%>"登录失败:读数据错误"
		else if(ret == -3)
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_MQ_9%>"));//<%IDS_MQ_9%>"登录失败:查找提示符"
		else if(ret == -4)
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_MQ_10%>"));//<%IDS_MQ_10%>"登录失败:查找登录提示符"
		else if(ret == -5)
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_MQ_11%>"));//<%IDS_MQ_11%>"登录失败:查找密码提示符"
		else 
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_MQ_12%>"));//<%IDS_MQ_12%>"登录失败:未知错误"

		bResult = FALSE;
		goto err;
	}

	if(DFNParser_GetPrivateProfileString("errorlog", "command", "", buffer, sizeof(buffer), inifile) <= 0)
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_LOGFILE_02%>"));
		bResult = FALSE;
		goto err;
	}

	if(DFNParser_GetPrivateProfileString("errorlog", "matchline", "", mbuffer, sizeof(mbuffer), inifile) <= 0)
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_LOGFILE_02%>"));
		bResult = FALSE;
		goto err;
	}

	if(DFNParser_GetPrivateProfileString("date", "command", "", mdate, sizeof(mdate), inifile) <= 0)
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_LOGFILE_02%>"));
		bResult = FALSE;
		goto err;
	}
	
	isChinese = DFNParser_GetPrivateProfileInt("date", "isChinese", 0, inifile);

	if((ret = telnet_command(hSocket, mdate,pgd,&param)) < 0)
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_LOGFILE_01%>"));
		bResult = FALSE;
		goto err;
	}

	if(isChinese)
	{
		char	week[64] = {0};
		int		years = 0, months = 0, days = 0, 
				hours = 0, minutes = 0, seconds = 0;

		if(sscanf(pgd->databuffer, "公元%d年%d月%d日 %s %d时%d分%d秒", 
				&years, &months, &days, week, &hours, &minutes, &seconds) != 7)
		{
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_LOGFILE_01%>"));
			bResult = FALSE;
			goto err;
		}

		sprintf(curdate, "%2.2d%2.2d%2.2d%2.2d%2.2d", months, days, hours, minutes, years % 100);
	}
	else
	{
		char	week[16] = {0};
		char	month[16] = {0}; 
		int		day = 0;
		int		hours = 0, mins = 0, secs = 0;
		char	div[16] = {0};
		int		year = 0;
		if(sscanf(pgd->databuffer, "%s %s %d %d:%d:%d %s %d", week, month, &day, &hours, &mins, &secs, div, &year) != 8)
		{
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_LOGFILE_01%>"));
			bResult = FALSE;
			goto err;
		}

		if(convert_date(month, day, hours, mins, year, curdate))
		{
			sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_LOGFILE_01%>"));
			bResult = FALSE;
			goto err;
		}
	}

	sprintf(szTmpIniFile, "logfile.ini");
	DFN_GetPrivateProfileString(strmid, "lastdate", "", datebuff, sizeof(datebuff), szTmpIniFile);
	
	if(!*datebuff) strncpy(datebuff, curdate, 10);

	if(ca = strchr(buffer, '<')) 
	{
		strncpy(ca, datebuff, 10);
		*(ca + 10) = 0;
	}

	memset(pgd->databuffer, 0, BUF_SIZE);
	pgd->datalen = 0;
    printf("Error Report Command is :%s\n", buffer);
	if((ret = telnet_command(hSocket, buffer,pgd)) < 0)
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_LOGFILE_01%>"));
		bResult = FALSE;
		goto err;
	}

	if(ret == 0 || !strstr(pgd->databuffer, mbuffer))
	{
		char tmp [256] = {0};
		
		//ofstream fout("aixerr.log",ios::app);
		//int i = GetConfirms(strmid);
		//fout << itoa(i, tmp, 10) <<"\r\n"; 
		//fout << flush; 
		//fout.close();

		if(GetConfirms(strmid) > 0)
			DFN_WritePrivateProfileString(strmid, "needconfirm", _ltoa(FALSE, tmp, 10), szTmpIniFile);

		BOOL bChange = DFN_GetPrivateProfileInt(strmid, "needconfirm", FALSE, szTmpIniFile);
		if (!bChange)
		{
			sprintf(szReturn, "status=0$" ); //0: 未改变 1:改变
		}
		else
		{
			sprintf(szReturn, "status=1$" );
		}		
	}
	else
	{
		sprintf(szReturn, "status=1$" );

		FILE *fp = NULL;
		char szErrptLogFile[256] = {0};
		sprintf(szErrptLogFile, "%s\\data\\TmpIniFile\\logfile_%s.log", FuncGetInstallRootPath(), strmid);
		if(fp = fopen(szErrptLogFile, "a+"))
		{
			fprintf(fp, "%s", pgd->databuffer);
			fclose(fp);
		}

		char tmp [256] = {0};
        printf("Track record\n");
		DFN_WritePrivateProfileString(strmid, "needconfirm", _ltoa(TRUE, tmp, 10), szTmpIniFile);
	}
	DFN_WritePrivateProfileString(strmid, "lastdate", curdate, szTmpIniFile);
err:
	shutdown(hSocket, 0x02);
	closesocket(hSocket);
	delete pgd;
	return bResult;
}