User`s guide
KwikNet TCP/IP Sockets
K
A
DAK
221
kn_socket kn_socket
Purpose Create a Socket (an Endpoint for Communication)
Used by
n Task o ISP o Timer Procedure o Restart Procedure o Exit Procedure
Setup Prototype is in file KN_SOCK.H.
#include "KN_SOCK.H"
int kn_socket(int domain, int type, int protocol);
Description Domain specifies the communications domain within which
communication will occur. The domain identifies the protocol family
which should be used. The protocol family generally matches the
address family for the addresses supplied in subsequent socket
operations. The only protocol family support by
KwikNet is the ARPA
Internet Protocol, identified as
PF_INET . The corresponding address
family is AF_INET.
Type defines the semantics of communication supported by the socket.
Type must be SOCK_STREAM for use with the TCP protocol or
SOCK_DGRAM for use with the UDP protocol. The Turbo Treck TCP/IP
Stack also supports raw sockets which are identified as type SOCK_RAW
and used with the IP protocol.
The SOCK_STREAM type of socket provides sequenced, reliable, two-way
connection based byte streams. An out-of-band data transmission
mechanism can be supported.
The SOCK_DGRAM type of socket supports datagrams: connectionless,
unreliable messages of a fixed (typically small) maximum length.
The SOCK_RAW type of socket supports datagram at the IP protocol
layer, giving you full access to low level Internet services.
Protocol specifies a particular protocol to be used with the socket.
Normally only a single protocol exists to support a particular socket
type within a given protocol family. However, it is possible that many
protocols may exist, in which case a particular protocol must be
specified. Pick the protocol from the following table.
Family Type Protocol Used for
PF_INET SOCK_DGRAM IPPROTO_UDP UDP over IP
PF_INET SOCK_STREAM IPPROTO_TCP TCP over IP
PF_INET SOCK_RAW IPPROTO_ICMP ICMP over IP
PF_INET SOCK_RAW IPPROTO_IGMP IGMP over IP
...more