| |

VerySource

 Forgot password?
 Register
Search
View: 964|Reply: 4

Ask, in IOCP, how to associate the listening port with the completion port

[Copy link]

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Australia

Post time: 2020-1-18 10:00:01
| Show all posts |Read mode
I want to call AcceptEx after GetQueuedCompletionStatus call, but always returns 997 (Overlapped I / O operation is in progress)

The examples on the Internet are all copied from books. I have not seen such usage.
Please master help! !!
Reply

Use magic Report

0

Threads

24

Posts

19.00

Credits

Newbie

Rank: 1

Credits
19.00

 China

Post time: 2020-2-2 13:18:02
| Show all posts
AcceptEx / IOCP?

There is an example of this in the Sample directory of the Platform SDK.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-10 22:45:01
| Show all posts
It is estimated that the function that the host wants is not achieved, at least not the kind of effect that the host imagined, but AcceptEx is submitted one by one in order, but there are two kinds, one is to return immediately when connected, that is, set to wait for reception The buffer is 0, and the other is to wait for data to return. It is recommended that the host use not waiting for reception, so that AcceptEx will trigger the completion event as long as there is a connection, and then hand the Accept operation to the thread, and receive This thread that completes the event immediately starts a new AcceptEx, so that basically the purpose of the host can be achieved, and AcceptEx can submit multiple requests at the same time (the key is whether it is necessary, if the bottleneck lies in the Accept for the new connection, then Consider increasing the number of AcceptEx).
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-15 14:30:01
| Show all posts
CreateIoCompletionPort(THandle(sListen),hCompletion,DWORD(0),0);

AcceptEx(sListen,pBuffer^.sClient,pBuffer^.buf,pBuffer^.nLen-((sizeof(TSockAddrIn)+16)*2),sizeof(TSockAddrIn) + 16, sizeof(TSockAddrIn) + 16,dwBytes,@pBuffer ^.ol)
Reply

Use magic Report

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-8-19 21:00:01
| Show all posts
Thank you for your reply, the problem is solved. Basically AcceptEx is the same as WSARecv/WSASend, it can post n times and then wait for the message.
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