Description: a. determine the machine s IP and port, socket only with an IP and port binding, in order to function.
. b determine protocols: TCP or UDP.
Programming steps:
a. to establish a socket
b. Bind the machine IP and port
. c If TCP, because it is connection-oriented, and to take advantage of Listen () method to listen if anyone on the network to send their own thing if it is UDP, because it is not connected, so all comers.
Under d.TCP case, if listening to a connection, you can use the accept to accept the connection, then you can use the Send/Receive to perform the operation. The UDP, you do not need accept, directly SendTo/ReceiveFrom to perform the operation. (Note that because UDP does not need to establish a connection, so before sending did not know each other s IP and port, so you need to specify a sending node can perform normal transmission and reception)
e. not to continue sending and receiving using close.
To Search:
File list (Check if you may need any files):
socket.c
socket.h
main.c