Changeset 161074e in OpenModelica


Ignore:
Timestamp:
2020-09-24T14:23:19+02:00 (4 years ago)
Author:
Adeel Asghar <adeel.asghar@…>
Branches:
Added-citation-metadata, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
3152688, ef9d6fcf
Parents:
76de683
git-author:
Adeel Asghar <adeel.asghar@…> (09/23/20 17:37:39)
git-committer:
Adeel Asghar <adeel.asghar@…> (09/24/20 14:23:19)
Message:

Fixes ticket:6107 set tcp socket before sending data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/SimulationRuntime/c/simulation/simulation_runtime.cpp

    rdbb0b7ae r161074e  
    788788  initDumpSystem();
    789789
    790   if(setLogFormat(argc, argv) || helpFlagSet(argc, argv) || checkCommandLineArguments(argc, argv))
     790  int checkArgumentsRes = checkCommandLineArguments(argc, argv);
     791
     792#ifndef NO_INTERACTIVE_DEPENDENCY
     793  if(omc_flag[FLAG_PORT]) {
     794    std::istringstream stream(omc_flagValue[FLAG_PORT]);
     795    int port;
     796    stream >> port;
     797    sim_communication_port_open = 1;
     798    sim_communication_port_open &= sim_communication_port.create();
     799    sim_communication_port_open &= sim_communication_port.connect("127.0.0.1", port);
     800  }
     801#endif
     802
     803  int logFormatResult = setLogFormat(argc, argv);
     804
     805#ifndef NO_INTERACTIVE_DEPENDENCY
     806  if (isXMLTCP && !sim_communication_port_open) {
     807    errorStreamPrint(LOG_STDOUT, 0, "xmltcp log format requires a TCP-port to be passed (and successfully open)");
     808    EXIT(1);
     809  }
     810#endif
     811
     812  if(logFormatResult || helpFlagSet(argc, argv) || checkArgumentsRes)
    791813  {
    792814    infoStreamPrint(LOG_STDOUT, 1, "usage: %s", argv[0]);
     
    10591081#ifndef NO_INTERACTIVE_DEPENDENCY
    10601082  if(omc_flag[FLAG_PORT]) {
    1061     std::istringstream stream(omc_flagValue[FLAG_PORT]);
    1062     int port;
    1063     stream >> port;
    1064     sim_communication_port_open = 1;
    1065     sim_communication_port_open &= sim_communication_port.create();
    1066     sim_communication_port_open &= sim_communication_port.connect("127.0.0.1", port);
    1067 
    10681083    if(0 != strcmp("ia", data->simulationInfo->outputFormat)) {
    10691084      communicateStatus("Starting", 0.0, data->simulationInfo->startTime, 0);
    10701085    }
    1071   }
    1072 
    1073   if (isXMLTCP && !sim_communication_port_open) {
    1074     errorStreamPrint(LOG_STDOUT, 0, "xmltcp log format requires a TCP-port to be passed (and successfully open)");
    1075     EXIT(1);
    10761086  }
    10771087#endif
Note: See TracChangeset for help on using the changeset viewer.