Hi,
I have the following problem:
I have three servers, some may be down and some may reply but won't have the file I am looking for there might also be one that replies which has the file I am looking for.
This request runs async because otherwise I'll be waiting the TCP timeout (21 sec iirc ) before the other one gets run.
I have used Task.WhenAny for this and it works great if no other server replies because it will timeout and the server which has the file will be the fastest to reply.
Now comes my problem, servers which may not have the file may still reply faster than the one which does have the file making a Null result the fastest result even though there is a reply coming with the file that I want.
Can I use the Task result to filter out the ones i don't want and keep waiting for other results? Stopping when i have what i want?
It is not immediately clear how to this with the Task construct.
I have the following problem:
I have three servers, some may be down and some may reply but won't have the file I am looking for there might also be one that replies which has the file I am looking for.
This request runs async because otherwise I'll be waiting the TCP timeout (21 sec iirc ) before the other one gets run.
I have used Task.WhenAny for this and it works great if no other server replies because it will timeout and the server which has the file will be the fastest to reply.
Now comes my problem, servers which may not have the file may still reply faster than the one which does have the file making a Null result the fastest result even though there is a reply coming with the file that I want.
Can I use the Task result to filter out the ones i don't want and keep waiting for other results? Stopping when i have what i want?
It is not immediately clear how to this with the Task construct.