sock_accept
Declaration
errno_t sock_accept(socket_t so, struct sockaddr *from, int fromlen, int flags, sock_upcall callback, void *cookie, socket_t *new_so);Parameters
- so:
The listening socket you'd like to accept a connection on.
- from:
A pointer to a socket address that will be filled in with the address the connection is from.
- fromlen:
Maximum length of from.
- flags:
Supports MSG_DONTWAIT and MSG_USEUPCALL. If MSG_DONTWAIT is set, accept will return EWOULDBLOCK if there are no connections ready to be accepted. If MSG_USEUPCALL is set, the created socket will use the same upcall function attached to the original socket.
- callback:
A notifier function to be called when an event occurs on the socket. This may be NULL.
- cookie:
A cookie passed directly to the callback.
- new_so:
Upon success, *new_so will be a reference to a new socket for tracking the connection.
Return Value
0 on success otherwise the errno error.
Discussion
Accepts an incoming connection on a socket. See 'man 2 accept' for more information. Allocating a socket in this manner creates a socket with no associated file descriptor.
See Also
Network Kernel Extensions
sock_bindsock_closesock_connectsock_getpeernamesock_getsocknamesock_getsockoptsock_gettypesock_inject_data_insock_inject_data_outsock_ioctlsock_isconnectedsock_isnonblockingsock_listensock_receivesock_receivembufsock_sendsock_sendmbufsock_setprivsock_setsockoptsock_shutdownsock_socketsockopt_copyinsockopt_copyoutsockopt_directionsockopt_levelsockopt_namesockopt_valsizeifaddr_addressifaddr_address_familyifaddr_dstaddressifaddr_findbestforaddrifaddr_ifnetifaddr_netmaskifaddr_referenceifaddr_releaseifaddr_withaddrifaddr_withdstaddrifaddr_withnetifaddr_withrouteiflt_attachiflt_detachifmaddr_addressifmaddr_ifnetifmaddr_lladdressifmaddr_referenceifmaddr_releaseifnet_add_multicastifnet_addrlenifnet_allocateifnet_attachifnet_attach_protocolifnet_attach_protocol_v2ifnet_baudrateifnet_capabilities_enabledifnet_capabilities_supportedifnet_detachifnet_detach_protocolifnet_eventifnet_familyifnet_find_by_nameifnet_flagsifnet_free_address_listifnet_free_multicast_listifnet_get_address_listifnet_get_address_list_familyifnet_get_link_mib_dataifnet_get_link_mib_data_lengthifnet_get_multicast_listifnet_get_tso_mtuifnet_get_wake_flagsifnet_hdrlenifnet_indexifnet_inputifnet_interface_family_findifnet_ioctlifnet_lastchangeifnet_list_freeifnet_list_getifnet_lladdr_copy_bytesifnet_llbroadcast_copy_bytesifnet_metricifnet_mtuifnet_nameifnet_offloadifnet_outputifnet_output_rawifnet_referenceifnet_releaseifnet_remove_multicastifnet_resolve_multicastifnet_set_addrlenifnet_set_baudrateifnet_set_capabilities_enabledifnet_set_capabilities_supportedifnet_set_flagsifnet_set_hdrlenifnet_set_link_mib_dataifnet_set_lladdrifnet_set_metricifnet_set_mtuifnet_set_offloadifnet_set_promiscuousifnet_set_statifnet_set_tso_mtuifnet_set_wake_flagsifnet_softcifnet_statifnet_stat_incrementifnet_stat_increment_inifnet_stat_increment_outifnet_touch_lastchangeifnet_typeifnet_unit