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!
===socket=== The function ''socket()'' creates an endpoint for communication and returns a [[file descriptor]] for the socket. It uses three arguments: * {{mono|<var>domain</var>}}, which specifies the protocol family of the created socket. For example: **{{mono|PF_INET}} for network protocol [[IPv4]] (IPv4-only) ** {{mono|PF_INET6}} for [[IPv6]] (and in some cases, [[backward compatible]] with IPv4) ** {{mono|PF_UNIX}} for local socket (using a special filesystem node) * {{mono|<var>type</var>}}, one of: ** {{mono|SOCK_STREAM}} (reliable stream-oriented service or [[stream socket]]s) ** {{mono|SOCK_DGRAM}} (datagram service or [[datagram socket]]s) ** {{mono|SOCK_SEQPACKET}} (reliable sequenced packet service) ** {{mono|SOCK_RAW}} (raw protocols atop the network layer) * {{mono|<var>protocol</var>}} specifying the actual transport protocol to use. The most common are [[Transmission Control Protocol|{{mono|IPPROTO_TCP}}]], [[SCTP|{{mono|IPPROTO_SCTP}}]], [[User Datagram Protocol|{{mono|IPPROTO_UDP}}]], [[DCCP|{{mono|IPPROTO_DCCP}}]]. These protocols are specified in file ''netinet/in.h''. The value {{mono|0}} may be used to select a default protocol from the selected domain and type. The function returns {{mono|-1}} if an error occurred. Otherwise, it returns an integer representing the newly assigned descriptor.
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)