I**********s 发帖数: 441 | 1 Generally server recvs sth, then sends response,
and closes the connection. However sometimes it
requires the server to wait passively for the
client to shut down the connection, otherwise
server keeps connection open and waits for
client's next request. If so, what's the answer
for 1) and 2)?
Or is it that each time a new request opens a
new connection? If so, what's the answer for 2)?
1) What's the mechanism to indicate to the server
if the client has shut down connection or not?
2) And what's | w***s 发帖数: 21 | 2
It seems that you know nothing about socket programming.
ok, normally your program will block on command 'recv' or 'recvfrom'
so, to question 1, when the client close the connection. the recv will return
0.to question 2, when data is available on socket, recv will return with the
data length and the content of the data just received.
【在 I**********s 的大作中提到】 : Generally server recvs sth, then sends response, : and closes the connection. However sometimes it : requires the server to wait passively for the : client to shut down the connection, otherwise : server keeps connection open and waits for : client's next request. If so, what's the answer : for 1) and 2)? : Or is it that each time a new request opens a : new connection? If so, what's the answer for 2)? : 1) What's the mechanism to indicate to the server
|
|