03-24-2009
By default socket calls are blocking. To make them non blocking, use setsockopt() with a receive timeout. or use ioctl with FIONBIO request.
-Dheeraj
9 More Discussions You Might Find Interesting
1. Programming
Hello,
I actually try to make client-server program.
I'm using SCO OpenServer Release 5.0.0 and when I try to compile my code (by TELNET) I've got this error :
I'm just using this simple code :
and I get the same error if I use :
If someone can help me,
Thanks (2 Replies)
Discussion started by: soshell
2 Replies
2. UNIX for Dummies Questions & Answers
If I do a netstat -a I can see all the sockets currently open, is there a way that I can tell which application is holding open these sockets ? (3 Replies)
Discussion started by: murphyboy
3 Replies
3. UNIX for Dummies Questions & Answers
Hi all,
I am trying to connect the open socket and its owner PID on my Solaris9 system. But it seems not very easy.
As netstat is not as powerful as it is on Linux platform, without the "-program" option, and "lsof -i <UDP|TCP>@<hostIP>" won't show the one i want although it lists some... (1 Reply)
Discussion started by: sleepy_11
1 Replies
4. UNIX for Dummies Questions & Answers
Hello,
I want to test a firewall rule between 2 servers A & B.
I need a command that will open a socket on the server A such as:
themagiccommand MyPort
And on the client server B, i will run the command
telnet IP_serverA Myport
Can you help me ?
Thank you
Gunther (0 Replies)
Discussion started by: gunbol
0 Replies
5. UNIX for Advanced & Expert Users
Hi,
I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime.
To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies
6. Programming
Hi all,
On the server side, one socket is used for listening, the others are used for communicating with the client.
My question is: if i want to set option for socket, which socket should be set on?
If either can be set, what's the different?
Again, what's the different if set option... (1 Reply)
Discussion started by: blademan100
1 Replies
7. Programming
Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct...
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include... (3 Replies)
Discussion started by: cyler
3 Replies
8. Programming
Dear Experts,
i am compiling my code in suse 4.1 which is compiling fine,
but at runtime it is showing me for socket programming error no 88
as i searched in errno.h it is telling me socket operation on non socket,
what is the meaning of this , how to deal with this error , please... (1 Reply)
Discussion started by: vin_pll
1 Replies
9. IP Networking
I need clarification on whether it is okay to set socket options on a listening socket
simultaneously when it is being used in an accept() call?
Following is the scenario:-
-- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Discussion started by: jake24
2 Replies
LEARN ABOUT DEBIAN
avc_netlink_open
avc_netlink_loop(3) SELinux API documentation avc_netlink_loop(3)
NAME
avc_netlink_open, avc_netlink_close, avc_netlink_acquire_fd, avc_netlink_release_fd, avc_netlink_check_nb, avc_netlink_loop - SELinux
netlink processing.
SYNOPSIS
#include <selinux/selinux.h>
#include <selinux/avc.h>
int avc_netlink_open(int blocking);
void avc_netlink_close(void);
int avc_netlink_acquire_fd(void);
void avc_netlink_release_fd(void);
void avc_netlink_loop(void);
int avc_netlink_check_nb(void);
DESCRIPTION
These functions enable applications to handle notification of SELinux events via netlink. The userspace AVC normally checks for netlink
messages on each call to avc_has_perm(3). Applications may wish to override this behavior and check for notification separately, for exam-
ple in a select(2) loop. These functions also permit netlink monitoring without requiring a call to avc_open(3).
avc_netlink_open opens a netlink socket to receive SELinux notifications. The socket descriptor is stored internally; use
avc_netlink_acquire_fd(3) to take ownership of it in application code. The blocking argument controls whether the O_NONBLOCK flag is set
on the socket descriptor. avc_open(3) calls this function internally, specifying non-blocking behavior.
avc_netlink_close closes the netlink socket. This function is called automatically by avc_destroy(3).
avc_netlink_acquire_fd returns the netlink socket descriptor number and informs the userspace AVC not to check the socket descriptor auto-
matically on calls to avc_has_perm(3).
avc_netlink_release_fd returns control of the netlink socket to the userspace AVC, re-enabling automatic processing of notifications.
avc_netlink_check_nb checks the netlink socket for pending messages and processes them. Callbacks for policyload and enforcing changes
will be called; see selinux_set_callback(3). This function does not block.
avc_netlink_loop enters a loop blocking on the netlink socket and processing messages as they are received. This function will not return
unless an error occurs on the socket, in which case the socket is closed.
RETURN VALUE
avc_netlink_acquire_fd returns a non-negative file descriptor number on success. Other functions with a return value return zero on suc-
cess. On error, -1 is returned and errno is set appropriately.
SEE ALSO
avc_open(3), selinux_set_callback(3), selinux(8)
30 Mar 2009 avc_netlink_loop(3)