Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1026721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:07:37+00:00 2026-05-16T12:07:37+00:00

void PacketRecord::determineAppProtocol() { if (ipProtocol == IP_PROTO_UDP) { std::istringstream ss(udpData); std::string line; if (getline(ss,

  • 0
void PacketRecord::determineAppProtocol()
{
    if (ipProtocol == IP_PROTO_UDP)
    {
        std::istringstream ss(udpData);

        std::string line;
        if (getline(ss, line) && (line.find("SIP/2.0") != std::string::npos))
        {
            appProtocol = APP_PROTO_SIP;
        }
        else
        {
            appProtocol == APP_PROTO_RTP;
        }
    }
    else
    {
        appProtocol = APP_PROTO_UNKNOWN;
    }
}

If the inner if statement fails to evaluate to true, I would expect the else block to be executed (appProtocol set to APP_PROTO_RTP). However, this does not happen. Instead, it seems the else statement is completely ignored. I can’t fathom why this is the case.

As you can see from my gdb session, the first time the if statement works and appProtocol is set to APP_PROTO_SIP (as expected). the second time through, the if fails but instead of going into the else and setting appProtocol to APP_PROTO_RTP, it returns out of the function completely without setting appProtocol. appProtocol remains set to APP_PROTO_INVALID (the value it is initialized with in the PacketRecord ctor).

Breakpoint 1, PacketRecord::determineAppProtocol (this=0x805c6c8) at PacketRecord.cpp:156
156     if (ipProtocol == IP_PROTO_UDP)
(gdb) step
158         std::istringstream ss(udpData);
(gdb) 
159         std::string line;
(gdb) 
160         if (getline(ss, line) && (line.find("SIP/2.0") != std::string::npos))
(gdb) 
162             appProtocol = APP_PROTO_SIP;
(gdb) 
167         }
(gdb) 
173 }
(gdb) continue 
Continuing.

Breakpoint 1, PacketRecord::determineAppProtocol (this=0x8065388) at PacketRecord.cpp:156
156     if (ipProtocol == IP_PROTO_UDP)
(gdb) step
158         std::istringstream ss(udpData);
(gdb) 
159         std::string line;
(gdb) 
160         if (getline(ss, line) && (line.find("SIP/2.0") != std::string::npos))
(gdb) 
167         }
(gdb) 
173 }
(gdb) 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:07:38+00:00Added an answer on May 16, 2026 at 12:07 pm

    You should replace

    appProtocol == APP_PROTO_RTP;
    

    by

    appProtocol = APP_PROTO_RTP;
    

    (no double equal sign)

    The else statement is executed. But you are not assigning the value to appProtocol in it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 506k
  • Answers 506k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I believe they're roughly equal in what you can do… May 16, 2026 at 3:35 pm
  • Editorial Team
    Editorial Team added an answer It seems the issues I was facing, after finding appropriate… May 16, 2026 at 3:35 pm
  • Editorial Team
    Editorial Team added an answer Sounds like a simple isset() solves this problem. <?php $s… May 16, 2026 at 3:35 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

void weight_data::rev_seq(string &seq){ //TODO std::reverse(seq.begin(), seq.end()); } In this C++ method, I think this
void trim(string &str) { string::iterator it = str.begin(); string::iterator end = str.end() - 1;
void foo(void **Pointer); int main () { int *IntPtr; foo(&((void*)IntPtr)); } Why do I
void pushSynonyms (string synline, char matrizSinonimos [1024][1024]){ stringstream synstream(synline); vector<int> synsAux; int num; while
void max_idxs(vector<int> &pidxs){ vector<fragment *> ids; max_ids(ids); for(size_t i = 0; i < ids.size();
void turtle (int gtot) { int msg; fcntl(gtot,F_SETFL,O_NONBLOCK); read(gtot,&msg,4); gotoxy(12, 21); printf(The value of
void merge(vector<int> dst,vector<int> first,vector<int> second) { int i=0,j=0; while(i<first.size()&&j<second.size()) { if(first[i]<second[j]) { dst.push_back(first[i]); i++;
void (int a[]) { a[5] = 3; // this is wrong? } Can I
void addNewNode (struct node *head, int n) { struct node* temp = (struct node*)
void some_func(int param = get_default_param_value());

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.