Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - socket() fails with EAFNOSUPPORT(247): (9 Items)
   
socket() fails with EAFNOSUPPORT(247)  
I use QNX6.3.2 and facing some issues in socket operation.

socket() call fails with errno=247(EAFNOSUPPORT).

socket() is invoked with proper values,
AF_INET(2), SOCK_DGRAM(2), IPPROTO_UDP(17) and I verified
that all values are correct.

Somehow, the problem happens with only my load which has
multiple threads.
If I write down simple program invoking socket()
with the same arguments as the above,
socket() successes.

It seems there are not compatible libraries, etc.
linked when building my load. Honestly, I do not have clue.

I'm using -Vgcc_ntoppcbe -w0 with qcc/QCC
and using ntoppc-ld to build local libraries.

Is there anything that can affect simple socket operation?
I need to resolve the issue ASAP. So, I would appreciate
any inputs.
RE: socket() fails with EAFNOSUPPORT(247)  
Make sure io-net is running and npm-tcpip.so is
loaded therein.

-seanb

-----Original Message-----
From: David Chen [mailto:community-noreply@qnx.com]
Sent: Sat 10/23/2010 10:26 AM
To: qnx4-community
Subject: socket() fails with EAFNOSUPPORT(247)
 
I use QNX6.3.2 and facing some issues in socket operation.

socket() call fails with errno=247(EAFNOSUPPORT).

socket() is invoked with proper values,
AF_INET(2), SOCK_DGRAM(2), IPPROTO_UDP(17) and I verified
that all values are correct.

Somehow, the problem happens with only my load which has
multiple threads.
If I write down simple program invoking socket()
with the same arguments as the above,
socket() successes.

It seems there are not compatible libraries, etc.
linked when building my load. Honestly, I do not have clue.

I'm using -Vgcc_ntoppcbe -w0 with qcc/QCC
and using ntoppc-ld to build local libraries.

Is there anything that can affect simple socket operation?
I need to resolve the issue ASAP. So, I would appreciate
any inputs.




_______________________________________________

QNX4 Community Support
http://community.qnx.com/sf/go/post72130


Attachment: Text winmail.dat 3.01 KB
Re: RE: socket() fails with EAFNOSUPPORT(247)  
If I write a simple program to open socket, it works.
So, I think both are running in the board properly.
socket() fails only with my complete load.
RE: RE: socket() fails with EAFNOSUPPORT(247)  
A 'pidin me' or ls /dev/socket will
say for sure.

Regards,

-seanb

-----Original Message-----
From: David Chen [mailto:community-noreply@qnx.com]
Sent: Sat 10/23/2010 5:32 PM
To: qnx4-community
Subject: Re: RE: socket() fails with EAFNOSUPPORT(247)
 
If I write a simple program to open socket, it works.
So, I think both are running in the board properly.
socket() fails only with my complete load.




_______________________________________________

QNX4 Community Support
http://community.qnx.com/sf/go/post72153


Attachment: Text winmail.dat 2.61 KB
Re: RE: RE: socket() fails with EAFNOSUPPORT(247)  
I attached information on both programs below:

/* Information on the program causing SOCKET FAILURE */

# pidin -p rtrroot1287875760786 fds
     pid name               
  696343 rroot1287875760786 
           0   32778 rw        0 /dev/ttyp0
           1   32778 rw        0 /dev/ttyp0
           2   32778 rw        0 /dev/ttyp0
           3  462860 rw        0 /dev/osi/hdlc0
           0s      1 
# pidin -p rtrroot1287875760786 mem
     pid tid name               prio STATE           code  data         stack
  696343   1 rroot1287875760786  10r NANOSLEEP        404K  988K  8192(516K)*
  696343   2 rroot1287875760786  10r STOPPED          404K  988K  4096(132K) 
  696343   3 rroot1287875760786 133f CONDVAR          404K  988K   4096(20K) 
  696343   4 rroot1287875760786 137f CONDVAR          404K  988K   4096(20K) 
  696343   5 rroot1287875760786 146f CONDVAR          404K  988K   4096(20K) 
  696343   6 rroot1287875760786 148f STOPPED          404K  988K   4096(20K) 
  696343   7 rroot1287875760786 134f STOPPED          404K  988K   4096(20K) 
            libc.so.2          @fe300000             436K   32K
            libsocket.so.2     @fe378000             128K   24K
            rroot1287875760786 @4803e000 (       0)        8192
            rroot1287875760786 @480b2000 (       0)        4096
            rroot1287875760786 @480b3000 (       0)        428K
            rroot1287875760786 @fe375000 (       0)         12K
# 
# ls -al /dev/socket
total 0
srw-rw-rw-  1 root      0                 0 Oct 23 23:15 1
srw-rw-rw-  1 root      0                 0 Oct 23 23:15 17
srw-rw-rw-  1 root      0                 0 Oct 23 23:15 2
nrw-rw-rw-  1 root      0                 0 Oct 23 22:54 autoconnect
nrw-rw-rw-  1 root      0                 0 Oct 23 22:54 config
nrw-rw-rw-  1 root      0                 0 Oct 23 22:54 netmanager
# cat /dev/socket/config
# 




/* Information on sample program working FINE */

# ls -al /dev/socket
total 0
srw-rw-rw-  1 root      0                 0 Oct 23 23:19 1
srw-rw-rw-  1 root      0                 0 Oct 23 23:19 17
srw-rw-rw-  1 root      0                 0 Oct 23 23:19 2
nrw-rw-rw-  1 root      0                 0 Oct 23 23:09 autoconnect
nrw-rw-rw-  1 root      0                 0 Oct 23 23:09 config
nrw-rw-rw-  1 root      0                 0 Oct 23 23:09 netmanager
# pidin -p timertest_groot1287874936309 fds
     pid name               
 2527259 groot1287874936309 
           0   32778 rw        0 /dev/ttyp2
           1   32778 rw        0 /dev/ttyp2
           2   32778 rw        0 /dev/ttyp2
           3  364565 rw        0 I4U *.*                   *.*
           0s      1 
# pidin -p timertest_groot1287874936309 me
     pid tid name               prio STATE           code  data         stack
 2527259   1 groot1287874936309  10r STOPPED          104K   88K  8192(516K)*
 2527259   2 groot1287874936309  10r STOPPED          104K   88K  4096(132K) 
            libc.so.2          @fe300000             436K   32K
            libsocket.so.2     @fe378000             128K   44K
            groot1287874936309 @4803e000 (       0)        8192
            groot1287874936309 @4805b000 (       0)        8192
            groot1287874936309 @fe375000 (       0)         12K
Re: RE: RE: socket() fails with EAFNOSUPPORT(247)  
On Sat, Oct 23, 2010 at 08:01:13PM -0400, David Chen wrote:
> I attached information on both programs below:
> 

Make sure the program that doesn't work doesn't export
the SOCK envar to something non-existant.

Regards,

-seanb
Re: RE: RE: socket() fails with EAFNOSUPPORT(247)  
Our program doesn't use putenv() at all.

It seems that the problem is not related to what function we call
but to what we link with.

We tried with the same main program which calls only socket()
and display result:
- Link the main program with just system libraries -lc -lsocket -lrpc
     : socket() works fine
- Link the main program with our other modules, main program
     still does not call any other function except socket()
     : socket() fails

Note that the main program used above for 2 cases are exactly
the same. We just tried linking it with other libraries
and socket() fails when it's linked with our other modules.

The same result when -lrpc was excluded.
RE: RE: RE: socket() fails with EAFNOSUPPORT(247)  
Maybe it's inheriting it.  Check out
'pidin env' on your program.

-seanb


-----Original Message-----
From: David Chen [mailto:community-noreply@qnx.com]
Sent: Sun 10/24/2010 11:58 AM
To: qnx4-community
Subject: Re: RE: RE: socket() fails with EAFNOSUPPORT(247)
 
Our program doesn't use putenv() at all.

It seems that the problem is not related to what function we call
but to what we link with.

We tried with the same main program which calls only socket()
and display result:
- Link the main program with just system libraries -lc -lsocket -lrpc
     : socket() works fine
- Link the main program with our other modules, main program
     still does not call any other function except socket()
     : socket() fails

Note that the main program used above for 2 cases are exactly
the same. We just tried linking it with other libraries
and socket() fails when it's linked with our other modules.

The same result when -lrpc was excluded.




_______________________________________________

QNX4 Community Support
http://community.qnx.com/sf/go/post72176


Attachment: Text winmail.dat 2.93 KB
Re: RE: RE: RE: socket() fails with EAFNOSUPPORT(247)  
Compared pidin env between the working program and failing program
and they are exactly the same including SOCK.

Thanks