Operating System - HP-UX
1821608 Members
3566 Online
109633 Solutions
New Discussion юеВ

recvfrom not returning the source address

 
Antonio Lucas
New Member

recvfrom not returning the source address

Have a 64 bit listener program compiled in aCC version 5.50 on HPUX-11.23. This listener sets up a socket in datagram mode. When another program connects to it and sends a message the recvfrom does not return the address from where the message originated. The recvfrom from paramater is not null nor the fromlength.

The 32-bit version of this same program works.

It there something I need to set up to make the 64-bit version work?
4 REPLIES 4
rick jones
Honored Contributor

Re: recvfrom not returning the source address

Likely as not there is bug in your program - with either a debugger, diagnostic printf, or tusc system call trace, make sure you are still passing-in a valid pointer and length for the peer address. I am ass-u-me-ing that the recvfrom actually returns and returns the message itself yes?

Also, make sure there were no warnings during compilation.
there is no rest for the wicked yet the virtuous have no pillows
Antonio Lucas
New Member

Re: recvfrom not returning the source address

Ran this in the debugger. It is only getting the message and not the address from where it is originating from. The from and fromlength arguments are both non-null. They are both un-changed when the recvfrom call comes back.

Tried this same code compiled in 32-bit and ran in the debugger. The recvfrom worked as expected returning the message together with the address where it came from.
rick jones
Honored Contributor

Re: recvfrom not returning the source address

Are your sender and receiver small enough to post here along with the compilation lines you use?
there is no rest for the wicked yet the virtuous have no pillows
doufu3344
Visitor

Re: recvfrom not returning the source address

Sure, 13 years passed, but this is still int the top results from Google.

Today, the same problem comes to me, the same code, but recvfrom api works fine with 32 bit but not returns the source address with 64 bit.

After some search, I found the solution: My Compiling shell includes -D_XOPEN_SOURCE_EXTENDED, this leads program using xopen apis but this api looks like has some bugs in 64 bit mode.

I removed  -D_XOPEN_SOURCE_EXTENDED and changed my code to use the default api based recvfrom's man page (the main modify is changeing the last parameter from socklen_t to int). Now it works fine.