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!
==Blocking and non-blocking mode== Berkeley sockets can operate in one of two modes: [[blocking (computing)|blocking]] or non-blocking. A blocking socket does not return control until it has sent (or received) some or all data specified for the operation. It is normal for a blocking socket not to send all data. The application must check the return value to determine how many bytes have been sent or received and it must resend any data not already processed.<ref>{{cite web|url=http://beej.us/guide/bgnet/ |title=Beej's Guide to Network Programming |publisher=Beej.us |date=2007-05-05 |access-date=2012-07-26}}</ref> When using blocking sockets, special consideration should be given to accept() as it may still block after indicating readability if a client disconnects during the connection phase. A non-blocking socket returns whatever is in the receive buffer and immediately continues. If not written correctly, programs using non-blocking sockets are particularly susceptible to [[race condition]]s due to variances in network link speed.{{citation needed|date=May 2021}} A socket is typically set to blocking or non-blocking mode using the functions [[fcntl]] and [[ioctl]].
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)