| |

VerySource

 Forgot password?
 Register
Search
View: 940|Reply: 9

Why doesn't my GetQueuedCompletionStatus return in IOCP?

[Copy link]

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-19 19:20:01
| Show all posts |Read mode
I use
(1) accept accepted the connection
(2) CreateIoCompletionPort () adds the connection to the completion port
Why does GetQueuedCompletionStatus not return after the client (telnet) is connected?
Reply

Use magic Report

0

Threads

70

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-1-27 10:54:01
| Show all posts
Did the server accept the client's connection and then post the receive operation?
Reply

Use magic Report

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Japan

 Author| Post time: 2020-1-27 18:27:01
| Show all posts
Ask upstairs, what is: "Received delivery operation"?
Reply

Use magic Report

0

Threads

70

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-1-27 20:18:01
| Show all posts
WSARecv operation, did you do it
Reply

Use magic Report

0

Threads

24

Posts

19.00

Credits

Newbie

Rank: 1

Credits
19.00

 China

Post time: 2020-2-2 11:27:01
| Show all posts
What about the code?
Can read about Windows network programming
Or visit
www.codeproject.com/internet
Reply

Use magic Report

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Australia

 Author| Post time: 2020-2-6 23:00:02
| Show all posts
Brothers, I posted a lot of code, too annoying, I used the爱德华德suggestion, and the current process becomes
Accept when there is a connection
2. WSARecv ()-returns 997
3. Call CreateIoCompletionPort () to add acceptedSock to the completion port

4. In the worker thread, after GetQueuedCompletionStatus () returns, call WSARecv (), always returning 997

What solution?
Reply

Use magic Report

0

Threads

70

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-2-7 02:45:01
| Show all posts
WSARecv returns 997 is normal
Reply

Use magic Report

0

Threads

70

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-2-7 06:30:01
| Show all posts
Not an error, this is a characteristic of the completion port
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-15 10:15:01
| Show all posts
Accept when there is a connection
2. WSARecv ()-returns 997
3. Call CreateIoCompletionPort () to add acceptedSock to the completion port

==>

Accept when there is a connection
2. Call CreateIoCompletionPort () to add acceptedSock to the completion port
3. WSARecv ()-returns 997
Reply

Use magic Report

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Australia

 Author| Post time: 2020-2-21 14:00:01
| Show all posts
Thank you all for your help, I finally want to take a big step forward and I can receive data from the client. I found that WSARecv () called after accept is equivalent to setting the buffer and other things, and GetQueuedCompletionStatus uses these things to fill the buffer. If the buffer is large enough, WSARecv () after GetQueuedCompletionStatus () is not necessary. Conversely, if the buffer is not large enough, WSARecv () is necessary, and each time WSARecv () will affect the buffer of GetQueuedCompletionStatus ().
Not all the inside story of IOCP is clear, but it is already moving forward.

toxop000:
  I also think it should be your order, but I can still follow the previous order. Presumably the functions of Winsock are smart enough? Information is stored in the system when WSARecv () is called, so calling CreateIoCompletionPort () afterwards can also IO normally?
  Is there a master to share the inside story?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list