|
|
1.1 ! root 1: .TH UDP 3X ! 2: .CT 2 comm_mach ! 3: .SH NAME ! 4: udp_connect, udp_listen, udp_datagram \(mi udp networking functions ! 5: .SH SYNOPSIS ! 6: .nf ! 7: .B #include <sys/inet/udp_user.h> ! 8: .PP ! 9: .B int udp_connect(sport, dhost, dport) ! 10: .B in_addr dhost; ! 11: .B udp_port sport, dport; ! 12: .PP ! 13: .B int udp_listen(sport, reply) ! 14: .B udp_port sport; ! 15: .B struct udpreply *reply; ! 16: .PP ! 17: .B int udp_datagram(sport) ! 18: .B udp_port sport; ! 19: .PP ! 20: .SH DESCRIPTION ! 21: These routines are loaded by the ! 22: .B -lin ! 23: option of ! 24: .IR ld (1). ! 25: .PP ! 26: UDP (universal datagram protocol) is a protocol layered ! 27: upon IP (internet protocol). ! 28: It provides datagram service between end points called sockets. ! 29: A socket address is composed of the internet address ! 30: of its host and the port number to which ! 31: the socket is bound. ! 32: .PP ! 33: .I Udp_connect ! 34: returns the file descriptor of a UDP socket bound to port ! 35: .I sport. ! 36: Each ! 37: .IR read (2) ! 38: from this file descriptor will only accept datagrams from the UDP ! 39: socket at host ! 40: .I dhost, ! 41: port ! 42: .IR dport ; ! 43: a ! 44: .IR write ! 45: on this file descriptor will be sent to that socket. ! 46: .PP ! 47: .I Udp_listen ! 48: returns the file descriptor of a UDP socket bound to port ! 49: .I sport ! 50: and waits for a datagram to be sent to that port. ! 51: Once a message has been received from another socket, ! 52: all writes ! 53: will go to that socket and ! 54: reads will only accept data from that socket. ! 55: .PP ! 56: .I Udp_datagram ! 57: returns the file descriptor of a UDP socket bound to port ! 58: .I sport. ! 59: Messages written to the file descriptor must start with a ! 60: .B struct udpaddr ! 61: which contains the destination of the message. ! 62: .IP ! 63: .EX ! 64: .ta \w'struct 'u +\w'updaddr 'u ! 65: struct udpaddr { ! 66: in_addr host; ! 67: int port; ! 68: }; ! 69: .EE ! 70: .PP ! 71: Messages read from the file descriptor also start with a ! 72: .B struct udpaddr ! 73: and contain the address of the source socket. ! 74: .SH FILES ! 75: .TP 12 ! 76: .F /dev/udp* ! 77: the socket devices ! 78: .SH SEE ALSO ! 79: .IR internet (3), ! 80: .IR tcp (3) ! 81: .SH DIAGNOSTICS ! 82: All these routines ! 83: returns \-1 on failure.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.