Socket States Flashcards

1
Q

List the 6 events associated with WSAAsyncSelect( ).

A

FD_ACCEPT : (Socket State) connection pending: connection request received (stream sockets only)

FD_CLOSE : close pending: connection close received (graceful close or abort) (stream sockets only)

FD_CONNECT : connected : connection now established

FD_OOB : “Out of band” data readability (stream sockets only)

FD_READ : readable : data received by network system is ready for application to read

FD_WRITE : writable : send is possible (network system buffers available for outgoing data)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why do events have re-enabling functions?

A

So that WinSock DLL can avoid flooding an application with notification messages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What function detects readable socket state?

A

ioctlsocket() FIONREAD

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the FD_ACCEPT event notify an application of?

A

the connection pending state (arrival of an incoming connection request)…indicates that a call to accept() should succeed immediately

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A accept() call on a server signals a ______ on a client.

A

FD_CONNECT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A connect() call on a client signals a ______ on a server.

A

FD_ACCEPT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A send() call reenables a ________.

A

FD_WRITE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A recv() call reenables a __________.

A

FD_READ

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

closesocket() call signals a __________.

A

FD_CLOSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which of the following is/are part of the three basic methods of socket state detection?

a. asynchronous notification
b. function call for success or failure
c. synchronous detection
d. all answers are correct

A

d. all answers are correct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

After the closesocket( ) function returns, any function call that references that socket descriptor will fail with a _____________________________ error.

a. None of these
b. WSAELASTERROR 10048
c. WSAENOTSOCK 10038
d. WSAERRLAST 10064

A

c. WSAENOTSOCK 10038

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What function is the synchronous counterpart of WSAAsyncSelect( )?

A

select()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the name the parameter of the asynchronous notification message, which contains the socket handle.

A

wParam

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

___________detection means the WinSock DLL detects a socket state at any time after an application calls the asynchronous socket state detection function.

A

Asynchronous

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

A datagram socket is writable as soon as it is opened, and it is readable as soon as it is _________.

A

named

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

True or False

Basically the only state most datagram applications need to detect and act upon is the readable state.

A

True

17
Q

True or False

Data transmission on a datagram socket is reliable.

A

False