HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Unable to add a socket
Operating System - HP-UX
1833452
Members
3331
Online
110052
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
03-19-2001 10:54 AM
03-19-2001 10:54 AM
Unable to add a socket
Hi all,
I am trying to develop a system (in C under HP-Unix) which would read the syslog messages and work on it. So i tried to create a socket through a call to the "system" function alongwith the variable returned by tmpnam as follows,
char socknam[L_tmpnam + 1];
int optn = 1;
int sockFd = -1;
struct sockaddr_un SockAddr;
char sAux[512];
struct timeval TimeVal;
fd_set ReadList;
tmpnam(socknam);
sockFd = socket(AF_UNIX,SOCK_STREAM,0);
ioctl(sockFd,FIONBIO,&optn);
unlink(socknam);
SockAddr.sun_family=AF_UNIX;
strncpy(SockAddr.sun_path,socknam,sizeof(SockAddr.sun_path)-1);
bind(sockFd,(struct sockaddr_un*)&SockAddr,sizeof(struct sockaddr_un));
listen(sockFd,SOMAXCONN);
sprintf(sAux,"syslgcmd add %s 2> /dev/null",socknam);
system(sAux);
select(sockFd + 1, &ReadList, 0, 0, &TimeVal);
And it always gets timed out in this "select" call, when i have set TimeVal.tv_sec = 10, or in other words it returns zero always.
And when i view the syslog i find that it states, unable to open the particular file which is value of the variable "socknam"(like /var/tmp/aaaa....), and says file ignored. And when i type the command "syslgcmd stats" i dont see this socket being added to the list. When i try to view that particular file(which is present temporarily till the program is running) i am prompted that the operation is not supported.
Can anyone pour some light on this issue as to where probably i might be going wrong.
Thanking u in anticipation.
Raj.
I am trying to develop a system (in C under HP-Unix) which would read the syslog messages and work on it. So i tried to create a socket through a call to the "system" function alongwith the variable returned by tmpnam as follows,
char socknam[L_tmpnam + 1];
int optn = 1;
int sockFd = -1;
struct sockaddr_un SockAddr;
char sAux[512];
struct timeval TimeVal;
fd_set ReadList;
tmpnam(socknam);
sockFd = socket(AF_UNIX,SOCK_STREAM,0);
ioctl(sockFd,FIONBIO,&optn);
unlink(socknam);
SockAddr.sun_family=AF_UNIX;
strncpy(SockAddr.sun_path,socknam,sizeof(SockAddr.sun_path)-1);
bind(sockFd,(struct sockaddr_un*)&SockAddr,sizeof(struct sockaddr_un));
listen(sockFd,SOMAXCONN);
sprintf(sAux,"syslgcmd add %s 2> /dev/null",socknam);
system(sAux);
select(sockFd + 1, &ReadList, 0, 0, &TimeVal);
And it always gets timed out in this "select" call, when i have set TimeVal.tv_sec = 10, or in other words it returns zero always.
And when i view the syslog i find that it states, unable to open the particular file which is value of the variable "socknam"(like /var/tmp/aaaa....), and says file ignored. And when i type the command "syslgcmd stats" i dont see this socket being added to the list. When i try to view that particular file(which is present temporarily till the program is running) i am prompted that the operation is not supported.
Can anyone pour some light on this issue as to where probably i might be going wrong.
Thanking u in anticipation.
Raj.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2001 06:12 AM
03-20-2001 06:12 AM
Re: Unable to add a socket
Raj,
I've got two places for you to look for more help with regards to socket programming.
First, the directory /usr/lib/demos/networking
contains some excellent example client and server programs. Each of the 3 subdirectories is dedicated to example programs for af_unix, dlpi and (Network) socket.
The second place to look is online at http://docs.hp.com -> Networking/Communications
-> LAN/9000 -> BSD Sockets Interface Programmer's Guide (HP-UX 10.x, HP-UX 11.0)
And now that I think of it, there are THREE places to look for more details, if you include the man page for the system call(s) in question.
Hope this helps,
-> Brian Hackley
I've got two places for you to look for more help with regards to socket programming.
First, the directory /usr/lib/demos/networking
contains some excellent example client and server programs. Each of the 3 subdirectories is dedicated to example programs for af_unix, dlpi and (Network) socket.
The second place to look is online at http://docs.hp.com -> Networking/Communications
-> LAN/9000 -> BSD Sockets Interface Programmer's Guide (HP-UX 10.x, HP-UX 11.0)
And now that I think of it, there are THREE places to look for more details, if you include the man page for the system call(s) in question.
Hope this helps,
-> Brian Hackley
Ask me about telecommuting!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP