10

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 the function:

int fd = SSL_get_fd(...);

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

int sd = socket(...);

Can anyone explain, what does FD and SD stand for?

Thanks

Community
  • 1
  • 1
Martin Heralecký
  • 5,415
  • 2
  • 22
  • 59

2 Answers2

16

SSL_get_fd:

SSL_get_fd() returns the file descriptor

File Descriptor:

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

wfd, rfd will stand for write-FD and read-FD. sd is not a standard moniker, but it will likely stand for 'socket file descriptor', ie. a FD that corresponds to a socket. From the same SSL_get_fd page:

fd will typically be the socket file descriptor of a network connection

Remus Rusanu
  • 281,117
  • 39
  • 423
  • 553
5

"fd" is generally an abbreviation of File Descriptor. On POSIX systems like Linux, OSX and the BSD variants a file descriptor is used not only for files, but for sockets, device communication and other things as well

Some programmer dude
  • 380,411
  • 33
  • 383
  • 585