sockatmark - Online Linux Manual PageSection : 3
Updated : 2022-12-15
Source : Linux man-pages 6.03
NAMEsockatmark − determine whether socket is at out-of-band mark
LIBRARYStandard C library (libc, −lc)
SYNOPSIS#include <sys/socket.h>int sockatmark(int sockfd);Feature Test Macro Requirements for glibc (see feature_test_macros(7)): sockatmark(): _POSIX_C_SOURCE >= 200112L
DESCRIPTIONsockatmark() returns a value indicating whether or not the socket referred to by the file descriptor sockfd is at the out-of-band mark. If the socket is at the mark, then 1 is returned; if the socket is not at the mark, 0 is returned. This function does not remove the out-of-band mark.
RETURN VALUEA successful call to sockatmark() returns 1 if the socket is at the out-of-band mark, or 0 if it is not. On error, −1 is returned and errno is set to indicate the error.
ERRORSEBADF sockfd is not a valid file descriptor. EINVAL sockfd is not a file descriptor to which sockatmark() can be applied.
VERSIONSsockatmark() was added in glibc 2.2.4.
ATTRIBUTESFor an explanation of the terms used in this section, see attributes(7). InterfaceAttributeValue sockatmark() Thread safetyMT-Safe
STANDARDSPOSIX.1-2001, POSIX.1-2008.
NOTESIf sockatmark() returns 1, then the out-of-band data can be read using the MSG_OOB flag of recv(2). Out-of-band data is supported only on some stream socket protocols. sockatmark() can safely be called from a handler for the SIGURG signal. sockatmark() is implemented using the SIOCATMARK ioctl(2) operation.
BUGSPrior to glibc 2.4, sockatmark() did not work.
EXAMPLESThe following code can be used after receipt of a SIGURG signal to read (and discard) all data up to the mark, and then read the byte of data at the mark: char buf[BUF_LEN];
char oobdata;
int atmark, s;
for (;;) {
atmark = sockatmark(sockfd);
if (atmark == −1) {
perror("sockatmark");
break;
}
if (atmark)
break;
s = read(sockfd, buf, BUF_LEN);
if (s == −1)
perror("read");
if (s <= 0)
break;
}
if (atmark == 1) {
if (recv(sockfd, &oobdata, 1, MSG_OOB) == −1) {
perror("recv");
...
}
}
SEE ALSOfcntl(2), recv(2), send(2), tcp(7) 0
Johanes Gumabo
Data Size : 11,661 byte
man-sockatmark.3Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 2 / 236,591
Visitor ID : :
Visitor IP : 3.149.254.229 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.