Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Berkeley sockets
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===connect=== ''connect()'' establishes a direct communication link to a specific remote host identified by its address via a socket, identified by its file descriptor. When using a [[Connection-oriented communication|connection-oriented]] protocol, this establishes a connection. Certain types of protocols are connectionless, most notably the [[User Datagram Protocol]]. When used with connectionless protocols, ''connect'' defines the remote address for sending and receiving data, allowing the use of functions such as ''send'' and ''recv''. In these cases, the connect function prevents reception of datagrams from other sources. ''connect()'' returns an integer representing the error code: ''0'' represents success, while ''β1'' represents an error. Historically, in BSD-derived systems, the state of a socket descriptor is undefined if the call to ''connect'' fails (as it is specified in the Single Unix Specification), thus, portable applications should close the socket descriptor immediately and obtain a new descriptor with socket(), in the case the call to connect() fails.{{sfn|Stevens|Rago|2013|p=607}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)