Unix Socket Programming Interview Questions

 
1.
How do Sockets Work?
2.
What is with the second parameter in bind()?
3.
If bind() fails, what should I do with the socket descriptor?
4.
When should I use shutdown()?
5.
Code Sample: a very simple client process.
6.
What are Sockets?
7.
How can I tell when a socket is closed on the other end?
8.
How do I get the port number for a given service?
9.
How do I properly close a socket?
10.
What is the difference between close() and shutdown()?
11.
Explain the TIME_WAIT state.
12.
How can I put a timeout on connect()?
13.
Why does the sockets buffer fill up sooner than expected?
14.
How often should I re-transmit un-acknowleged messages?
15.
How can I be sure that a UDP message is received?
16.
of the socket? Does doing a connect() call affect the receive behaviour?
17.
When should I use UDP instead of TCP?
18.
How can I read only one character at a time?
19.
What is the difference between SO_REUSEADDR and SO_REUSEPORT?
20.
How do I get my server to find out the clients address / host- name?
21.
What exactly does SO_KEEPALIVE do?
22.
What exactly does SO_REUSEADDR do?
23.
How can I make my server a daemon?
24.
How come I get address already in use from bind()?
25.
Why do I get connection refused when the server is not running?
26.
How can I set the timeout for the connect() system call?
27.
Why does connect() succeed even before my server did an accept()?
28.
How do I convert a string into an internet address?
29.
What are socket exceptions? What is out-of-band data?
30.
Why do I keep getting EINTR from the socket calls?
31.
Is there any advantage to handling the signal, rather than just ignoring it and checking for the EPIPE error? Are there any useful parameters passed to the signal catching function?
32.
How do I send [this] over a socket?
33.
How come select says there is data, but read returns zero?
34.
How can I force a socket to send the data in its buffer?
35.
What are the pros/cons of select(), non-blocking I/O and SIGIO?
36.
Why does it take so long to detect that the peer died?
37.
Why do I get EPROTO from read()?
38.
Where can a get a library for programming sockets?
39.
Whats the difference between select() and poll()?
40.
How do I use TCP_NODELAY?
41.
What is the difference between read() and recv()?
42.
After the chroot(), calls to socket() are failing. Why?
43.
When will my application receive SIGPIPE?
44.
How can I find the full hostname (FQDN) of the system I am running on?
45.
How can my client work through a firewall/proxy server?
46.
Why do I sometimes lose a servers address when using more than one server?
47.
system choose one for me on the connect() call? Should I bind() a port number in my client program, or let the?
48.
over the socket? Is there a way to have a dynamic buffer? What does one do when one does not know how much information is coming?
49.
Why do not my sockets close?
50.
How can I listen on more than one port at a time?
51.
What exactly does SO_LINGER do?
52.
How can I bind() to a port number < 1024?
53.
How should I choose a port number for my server?
54.
How can I write a multi-homed server?
55.
What is the difference between connected and unconnected sockets?
56.
How can I read ICMP errors from connected UDP sockets?
57.
How can I be sure that UDP messages are received in order?
58.
How come only the first part of my datagram is getting through?
59.
How would I put my socket in non-blocking mode?
60.
How do Sockets Work?
61.
What is with the second parameter in bind()?
62.
If bind() fails, what should I do with the socket descriptor?
63.
When should I use shutdown()?
64.
Code Sample: a very simple client process.
65.
What are Sockets?
66.
How can I tell when a socket is closed on the other end?
67.
How do I get the port number for a given service?
68.
How do I properly close a socket?
69.
What is the difference between close() and shutdown()?
70.
Explain the TIME_WAIT state.
71.
How can I put a timeout on connect()?
72.
Why does the sockets buffer fill up sooner than expected?
73.
How often should I re-transmit un-acknowleged messages?
74.
How can I be sure that a UDP message is received?
75.
of the socket? Does doing a connect() call affect the receive behaviour?
76.
When should I use UDP instead of TCP?
77.
How can I read only one character at a time?
78.
What is the difference between SO_REUSEADDR and SO_REUSEPORT?
79.
How do I get my server to find out the clients address / host- name?
80.
What exactly does SO_KEEPALIVE do?
81.
What exactly does SO_REUSEADDR do?
82.
How can I make my server a daemon?
83.
How come I get address already in use from bind()?
84.
Why do I get connection refused when the server is not running?
85.
How can I set the timeout for the connect() system call?
86.
Why does connect() succeed even before my server did an accept()?
87.
How do I convert a string into an internet address?
88.
What are socket exceptions? What is out-of-band data?
89.
Why do I keep getting EINTR from the socket calls?
90.
Is there any advantage to handling the signal, rather than just ignoring it and checking for the EPIPE error? Are there any useful parameters passed to the signal catching function?
91.
How do I send [this] over a socket?
92.
How come select says there is data, but read returns zero?
93.
How can I force a socket to send the data in its buffer?
94.
What are the pros/cons of select(), non-blocking I/O and SIGIO?
95.
Why does it take so long to detect that the peer died?
96.
Why do I get EPROTO from read()?
97.
Where can a get a library for programming sockets?
98.
Whats the difference between select() and poll()?
99.
How do I use TCP_NODELAY?
100.
What is the difference between read() and recv()?
101.
After the chroot(), calls to socket() are failing. Why?
102.
When will my application receive SIGPIPE?
103.
How can I find the full hostname (FQDN) of the system I am running on?
104.
How can my client work through a firewall/proxy server?
105.
Why do I sometimes lose a servers address when using more than one server?
106.
system choose one for me on the connect() call? Should I bind() a port number in my client program, or let the?
107.
over the socket? Is there a way to have a dynamic buffer? What does one do when one does not know how much information is coming?
108.
Why do not my sockets close?
109.
How can I listen on more than one port at a time?
110.
What exactly does SO_LINGER do?
111.
How can I bind() to a port number < 1024?
112.
How should I choose a port number for my server?
113.
How can I write a multi-homed server?
114.
What is the difference between connected and unconnected sockets?
115.
How can I read ICMP errors from connected UDP sockets?
116.
How can I be sure that UDP messages are received in order?
117.
How come only the first part of my datagram is getting through?
118.
How would I put my socket in non-blocking mode?
119.
How do Sockets Work?
120.
What is with the second parameter in bind()?
121.
If bind() fails, what should I do with the socket descriptor?
122.
When should I use shutdown()?
123.
Code Sample: a very simple client process.
124.
What are Sockets?
125.
How can I tell when a socket is closed on the other end?
126.
How do I get the port number for a given service?
127.
How do I properly close a socket?
128.
What is the difference between close() and shutdown()?
129.
Explain the TIME_WAIT state.
130.
How can I put a timeout on connect()?
131.
Why does the sockets buffer fill up sooner than expected?
132.
How often should I re-transmit un-acknowleged messages?
133.
How can I be sure that a UDP message is received?
134.
of the socket? Does doing a connect() call affect the receive behaviour?
135.
When should I use UDP instead of TCP?
136.
How can I read only one character at a time?
137.
What is the difference between SO_REUSEADDR and SO_REUSEPORT?
138.
How do I get my server to find out the clients address / host- name?
139.
What exactly does SO_KEEPALIVE do?
140.
What exactly does SO_REUSEADDR do?
141.
How can I make my server a daemon?
142.
How come I get address already in use from bind()?
143.
Why do I get connection refused when the server is not running?
144.
How can I set the timeout for the connect() system call?
145.
Why does connect() succeed even before my server did an accept()?
146.
How do I convert a string into an internet address?
147.
What are socket exceptions? What is out-of-band data?
148.
Why do I keep getting EINTR from the socket calls?
149.
Is there any advantage to handling the signal, rather than just ignoring it and checking for the EPIPE error? Are there any useful parameters passed to the signal catching function?
150.
How do I send [this] over a socket?
151.
How come select says there is data, but read returns zero?
152.
How can I force a socket to send the data in its buffer?
153.
What are the pros/cons of select(), non-blocking I/O and SIGIO?
154.
Why does it take so long to detect that the peer died?
155.
Why do I get EPROTO from read()?
156.
Where can a get a library for programming sockets?
157.
Whats the difference between select() and poll()?
158.
How do I use TCP_NODELAY?
159.
What is the difference between read() and recv()?
160.
After the chroot(), calls to socket() are failing. Why?
161.
When will my application receive SIGPIPE?
162.
How can I find the full hostname (FQDN) of the system I am running on?
163.
How can my client work through a firewall/proxy server?
164.
Why do I sometimes lose a servers address when using more than one server?
165.
system choose one for me on the connect() call? Should I bind() a port number in my client program, or let the?
166.
over the socket? Is there a way to have a dynamic buffer? What does one do when one does not know how much information is coming?
167.
Why do not my sockets close?
168.
How can I listen on more than one port at a time?
169.
What exactly does SO_LINGER do?
170.
How can I bind() to a port number < 1024?
171.
How should I choose a port number for my server?
172.
How can I write a multi-homed server?
173.
What is the difference between connected and unconnected sockets?
174.
How can I read ICMP errors from connected UDP sockets?
175.
How can I be sure that UDP messages are received in order?
176.
How come only the first part of my datagram is getting through?
177.
How would I put my socket in non-blocking mode?
178.
How do Sockets Work?
179.
What is with the second parameter in bind()?
180.
If bind() fails, what should I do with the socket descriptor?
181.
When should I use shutdown()?
182.
Code Sample: a very simple client process.
183.
What are Sockets?
184.
How can I tell when a socket is closed on the other end?
185.
How do I get the port number for a given service?
186.
How do I properly close a socket?
187.
What is the difference between close() and shutdown()?
188.
Explain the TIME_WAIT state.
189.
How can I put a timeout on connect()?
190.
Why does the sockets buffer fill up sooner than expected?
191.
How often should I re-transmit un-acknowleged messages?
192.
How can I be sure that a UDP message is received?
193.
of the socket? Does doing a connect() call affect the receive behaviour?
194.
When should I use UDP instead of TCP?
195.
How can I read only one character at a time?
196.
What is the difference between SO_REUSEADDR and SO_REUSEPORT?
197.
How do I get my server to find out the clients address / host- name?
198.
What exactly does SO_KEEPALIVE do?
199.
What exactly does SO_REUSEADDR do?
200.
How can I make my server a daemon?
201.
How come I get address already in use from bind()?
202.
Why do I get connection refused when the server is not running?
203.
How can I set the timeout for the connect() system call?
204.
Why does connect() succeed even before my server did an accept()?
205.
How do I convert a string into an internet address?
206.
What are socket exceptions? What is out-of-band data?
207.
Why do I keep getting EINTR from the socket calls?
208.
Is there any advantage to handling the signal, rather than just ignoring it and checking for the EPIPE error? Are there any useful parameters passed to the signal catching function?
209.
How do I send [this] over a socket?
210.
How come select says there is data, but read returns zero?
211.
How can I force a socket to send the data in its buffer?
212.
What are the pros/cons of select(), non-blocking I/O and SIGIO?
213.
Why does it take so long to detect that the peer died?
214.
Why do I get EPROTO from read()?
215.
Where can a get a library for programming sockets?
216.
Whats the difference between select() and poll()?
217.
How do I use TCP_NODELAY?
218.
What is the difference between read() and recv()?
219.
After the chroot(), calls to socket() are failing. Why?
220.
When will my application receive SIGPIPE?
221.
How can I find the full hostname (FQDN) of the system I am running on?
222.
How can my client work through a firewall/proxy server?
223.
Why do I sometimes lose a servers address when using more than one server?
224.
system choose one for me on the connect() call? Should I bind() a port number in my client program, or let the?
225.
over the socket? Is there a way to have a dynamic buffer? What does one do when one does not know how much information is coming?
226.
Why do not my sockets close?
227.
How can I listen on more than one port at a time?
228.
What exactly does SO_LINGER do?
229.
How can I bind() to a port number < 1024?
230.
How should I choose a port number for my server?
231.
How can I write a multi-homed server?
232.
What is the difference between connected and unconnected sockets?
233.
How can I read ICMP errors from connected UDP sockets?
234.
How can I be sure that UDP messages are received in order?
235.
How come only the first part of my datagram is getting through?
236.
How would I put my socket in non-blocking mode?