I have 2 questions about sockets. Btw, my system is FreeBSD.
1- When I create a socket, I'm a little confused with the options.
Suppose I create a socket with the following options:
AF_INET, SOCK_xxx: I know what means AF_INET, but I'm confused about
the second one. What do they mean. I know what is a stream and
what is a packet. Does SOCK_STREAM means that there is a stream (maybe
buffered), like stdout and other file streams. Do I have to tell the
other end (the reading end) that I'm finished by closing the socket
(like in a pipe)? That is not the behavior I'm looking for.
I want to write a server that will manage a program that could have
multiple instances and to occasionnally send messages when particular
events occur (an instance has made a change somewhere and the server
would tell the other instances on the LAN, and things like that).
Would it be better to use datagrams? I thought that it would be better
to use TCP/IP sockets, since they provide part of what I'm expecting
from this network communication (reliable connections).
Also, is there a way to know from which machine an incoming connection
Btw, if you could point me to a Web Page that tells the relationships
between the 3 parameters of the socket function, I would appreciate it.
2- What happens when Out-of-Band data arrives? On FreeBSD, is it
put on the top of the receiving queue or is it put on another one. I've
read a book ("The design and implementation of the 4.3BSD UNIX OS")
that Out-of-Band data is not placed in the normal queue.
BY SENDING UNSOLLICITED, COMMERCIAL SPAM E-MAIL TO THIS ADDRESS,
YOU HEREBY AGREE TO RECEIVE UP TO 20 MEGABYTES OF
RANDOM CORE DUMP INFORMATION.