Section 5.14. Network Programming


5.14. Network Programming

Network programming makes it possible for two applications to communicate with each other through a common protocol. A socket is the basic interface that provides this communication link. It provides an end-to-end communications link between a client (requestor) and a server (providing service). AIX and Linux provide support for socket communications, and Table 5-10 compares differences between the two.

Table 5-10. AIX and Linux System API Comparison: Network Programming

AIX

Linux Equivalent

Description

accept

Accept

Accept connection on a socket.

bind

Bind

Bind an address to a socket.

connect

connect

Initiate a connection on a socket.

getdomainname setdomainnanme

geTDomainname setdomainname

Get/set domain name.

gethostid sethostid

gethostid sethosid

Get or set the unique identifier of the current host.

gethostname sethostname

gethostname sethostname

Get/set host name.

gethostbyname

gethostbyname

Get network host entry by name.

gethostbyaddr

gethostbyaddr

Get host entry by address.

getservbyname

getservbyname

Get service entry by name (according to /etc/services file).

getservbyport

getservbyport

Get service entry by port (according to /etc/services file).

getpeername

getpeername

Get name of connected peer socket.

getsockname

getsockname

Get socket name.

getsockopt setsockopt

getsockopt setsockoopt

Get/set options on a socket.

listen

listen

Listen for socket connections and limit the backlog of incoming connections.

recv

recv

Receive messages from connected sockets.

recvfrom

recvfrom

Receive messages from a connected or unconnected socket.

recvmsg

recvmsg

Receive messages from any socket. Identical to recvfrom.

send

send

Send a message from a socket.

sendmsg

sendmsg

Send a message from a connected or unconnected socket.

sendto

sendto

Send a message anytime. Identical to sendmsg.

sendfile

sendfile

Send data between file descriptors.

shutdown

shutdown

Shut down part of a full-duplex connection between two sockets.

socket

socket

Create an endpoint for communication.

socketpair

socketpair

Create a pair of connected sockets.


The sockets APIs originated with the 4.2BSD system released in 1983. The final release 4.4BSD at Berkley is widely used today and is considered the Berkley-derived implementation of sockets. The APIs in the preceding table are based on the Berkley-derived socket interface.




UNIX to Linux Porting. A Comprehensive Reference
UNIX to Linux Porting: A Comprehensive Reference
ISBN: 0131871099
EAN: 2147483647
Year: 2004
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net