Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

soc_gets() (gets) - get string from input buffer

&pagelevel(3)&pagelevel

#include <sys.socket.h>


Kernighan-Ritchie-C:
char *soc_gets(s, n, d);

char *s;
int n, d;

ANSI-C:
char* soc_gets(char* s, int n, int d);


Description

The soc_gets() function is only supported in the AF_INET and AF_INET6 address families and can only be used on stream sockets.

The soc_gets() function reads a character string of up to n-1 characters from the start of the input buffer of socket d into the buffer s. The maximum possible characters are read up to the first newline (represented by the sequence 0x15 in EBCDIC) or to the end of the input buffer of socket d or until n-1 characters are reached. The string returned in the buffer s is terminated with a null byte.

Return value

Pointer to the result string:

If successful.

Null pointer:

If read errors occur.

Errors indicated by errno

EWOULDBLOCK

The socket is marked as non-blocking, and the requested operation would block.