recvfrom() return -1 and errno EAGAIN

Z
zouqing23198
Mon, May 7, 2018 8:44 AM

Hi,

There are 3 computers, one server and two endpoints, as follows

version: pjproject-2.7.2
environment: ubuntu 14.04/16.04
server: 172.17.13.8 (sipserver stun/turn server)
client1: 172.17.13.222, registered successful with sip:101@172.17.13.8
client2: 192.168.1.103 (a routing sub-network behind 172.17.13.3), registered sip:102@172.17.13.8

while client1 makes a call to client2 using ICE with configuration,
client1: ./pjsua-x86_64-unknown-linux-gnu --id sip:101@172.17.13.8 --registrar sip:172.17.13.8 --realm 172.17.13.8  --username 101 --password 101 --stun-srv=172.17.13.8 --use-ice --use-turn --turn-srv=172.17.13.8:3488 --turn-user username1 --turn-passwd password1
client2: ./pjsua-x86_64-unknown-linux-gnu --id sip:102@172.17.13.8 --registrar sip:172.17.13.8 --realm 172.17.13.8  --username 102 --password 102 --stun-srv=172.17.13.8 --use-ice --use-turn --turn-srv=172.17.13.8:3488 --turn-user username2 --turn-passwd password2

len = recvfrom(sock, (char)buf, len, flags,
(struct sockaddr
)from, (socklen_t*)fromlen);

the function recvfrom() (in sock_bsd.c: pj_sock_recvfrom()) always return -1 and errno is 11(EAGAIN), but after read the data of received buffer is correct that compared with the tcpdump data. Why is it wrong to return -1 and buffer data is right?

However, if client2 is in upper level network directly and configure with ip 172.17.13.114, then client1 makes a call to client2, it can received the invite messgae(INVITE sip:102@172.17.13.114:5060;ob SIP/2.0 Record-Route: sip:172.17.13.8;r2=on;lr;nat=yes;did=04e.d39fa1e1 ...), and return value(1899 bytes), the length received, is right. it's always right.

Thanks,

Qing.zou

Hi, There are 3 computers, one server and two endpoints, as follows version: pjproject-2.7.2 environment: ubuntu 14.04/16.04 server: 172.17.13.8 (sipserver stun/turn server) client1: 172.17.13.222, registered successful with sip:101@172.17.13.8 client2: 192.168.1.103 (a routing sub-network behind 172.17.13.3), registered sip:102@172.17.13.8 while client1 makes a call to client2 using ICE with configuration, client1: ./pjsua-x86_64-unknown-linux-gnu --id sip:101@172.17.13.8 --registrar sip:172.17.13.8 --realm 172.17.13.8 --username 101 --password 101 --stun-srv=172.17.13.8 --use-ice --use-turn --turn-srv=172.17.13.8:3488 --turn-user username1 --turn-passwd password1 client2: ./pjsua-x86_64-unknown-linux-gnu --id sip:102@172.17.13.8 --registrar sip:172.17.13.8 --realm 172.17.13.8 --username 102 --password 102 --stun-srv=172.17.13.8 --use-ice --use-turn --turn-srv=172.17.13.8:3488 --turn-user username2 --turn-passwd password2 *len = recvfrom(sock, (char*)buf, *len, flags, (struct sockaddr*)from, (socklen_t*)fromlen); the function recvfrom() (in sock_bsd.c: pj_sock_recvfrom()) always return -1 and errno is 11(EAGAIN), but after read the data of received buffer is correct that compared with the tcpdump data. Why is it wrong to return -1 and buffer data is right? However, if client2 is in upper level network directly and configure with ip 172.17.13.114, then client1 makes a call to client2, it can received the invite messgae(INVITE sip:102@172.17.13.114:5060;ob SIP/2.0 Record-Route: <sip:172.17.13.8;r2=on;lr;nat=yes;did=04e.d39fa1e1> ...), and return value(1899 bytes), the length received, is right. it's always right. Thanks, Qing.zou