Socket programming, what is FD and SD

I am programming an SSL socket and many times I have seen something (variable name, function ...) with FD or SD in its name. For example, OpenSSL provides a function:

int fd = SSL_get_fd(...);

      

In many tutorials ( here , here, and here ), this is used:

int sd = socket(...);

      

Can anyone please explain what FD and SD mean?

thank

+3


source to share


2 answers


SSL_get_fd :

SSL_get_fd () returns a handle to the file

File descriptor :



On Unix operating systems and related computers, a file descriptor (FD, less commonly fildes) is an abstract indicator used to access a file or other I / O resource, such as a pipe or network connection. File descriptors are part of the POSIX API. A file descriptor is a non-negative integer, represented in the C programming language as an int.

wfd

, rfd

would mean write-FD and read-FD. sd

is not a standard nickname, but most likely it will stand for a socket file descriptor, i.e. FD that matches the socket. On the same page SSL_get_fd

:

fd will usually be the file descriptor for the network connection socket

+5


source


"fd" is usually an abbreviation for a file descriptor. On POSIX systems like Linux, OSX and BSD, the file descriptor is used not only for files, but also for sockets, device communications, and other things.



+1


source







All Articles