comparison utils/sip-rx-test.c @ 43:5995660dcbac

sip-rx-test, sip-udp-dump: fix bind error handling
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 04 Sep 2022 21:38:02 -0800
parents 891ebfb55e6b
children
comparison
equal deleted inserted replaced
42:891ebfb55e6b 43:5995660dcbac
103 } 103 }
104 sin.sin_family = AF_INET; 104 sin.sin_family = AF_INET;
105 sin.sin_addr.s_addr = INADDR_ANY; 105 sin.sin_addr.s_addr = INADDR_ANY;
106 sin.sin_port = htons(5060); 106 sin.sin_port = htons(5060);
107 rc = bind(sock, (struct sockaddr *) &sin, sizeof sin); 107 rc = bind(sock, (struct sockaddr *) &sin, sizeof sin);
108 if (rc < 0) 108 if (rc < 0) {
109 perror("bind"); 109 perror("bind");
110 exit(1);
111 }
110 addrlen = sizeof sin; 112 addrlen = sizeof sin;
111 rc = recvfrom(sock, pkt.pkt_buffer, MAX_SIP_RX_PACKET, 0, 113 rc = recvfrom(sock, pkt.pkt_buffer, MAX_SIP_RX_PACKET, 0,
112 (struct sockaddr *) &sin, &addrlen); 114 (struct sockaddr *) &sin, &addrlen);
113 if (rc < 0) { 115 if (rc < 0) {
114 perror("recvfrom"); 116 perror("recvfrom");