- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- on inet_ntoa in hp-ux
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2002 12:38 AM
08-27-2002 12:38 AM
on inet_ntoa in hp-ux
After an accept system call, when I perform an inet_ntoa, I get the result as "0.0.0.0" ? Why is it so ? The same code works fine in Linux with one exception. For the 1st accept it gives "0.0.0.0" and later it shows proper value !!!!! (Linux RedHat 6.2 Kernel 2.2.14-12 /glibc2.1.3-15)
Below is the portion of the sample program. Program was compiled using g++
struct sockaddr_in acc_addr;
memset(&acc_addr,0,sizeof(acc_addr));
if((sad = accept(s_sd,(struct sockaddr *)&acc_addr, &len)) < 0)
{
exit(1);
}
if(!fork())
{
unsigned char readbuff[SOCK_BUFF_SIZE];
cout << inet_ntoa(acc_addr.sin_addr)) << endl;
close(sad)
close(s_sd)
exit(0);
}
Thanks and Regards
Vishal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2002 12:42 AM
08-27-2002 12:42 AM
Re: on inet_ntoa in hp-ux
HP-UX 11.0
aCC 3.3 compiled
Thanks and Regards
Vishal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2002 08:38 PM
08-27-2002 08:38 PM
Re: on inet_ntoa in hp-ux
Thought will share with u ...
The 'len' value passed to 'accept' was not set. Hence the sockaddr_in structure - acc_addr was not getting populated properly.
An interesting aspect is .. it works fine in Linux !! If len is set to zero and we pass acc_addr, the len value is populated but not the acc_addr. In HP-UX , we need to let 'accept' know the value of len.
So the solution is ..
len = sizeof(acc_addr);
if((sad = accept(s_sd,(struct sockaddr *)&acc_addr, &len)) < 0)
{
exit(1);
}
Thanks and Regards
Vishal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2002 08:36 AM
08-28-2002 08:36 AM
Re: on inet_ntoa in hp-ux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 04:41 AM
09-26-2002 04:41 AM
Re: on inet_ntoa in hp-ux
Vishal