开发者

Working with hardware and timeouts .net

开发者 https://www.devze.com 2023-01-28 03:51 出处:网络
We are implementing a CardReader Terminal for CrediCard payments and I have a question about timeouts. The Terminal is connected trough the network. If we dont have an existing connection we tries to

We are implementing a CardReader Terminal for CrediCard payments and I have a question about timeouts. The Terminal is connected trough the network. If we dont have an existing connection we tries to 开发者_开发知识库connect to the ip-adress given by the customer.

The terminal will answer with an "Connected Event" if it succeeds in connecting, otherwise we dont get an event at all. So how can I handle the timeout in .net? Even if the terminal gets the connection it can take up to 10 seconds before the event is sent. Any suggestions for where I can find information about timeouts? Or any other good hints? :)


I assume that while connecting, the call to connect method is blocking the thread right? So all you have to do is to create a thread and call Connect method from there. Then you can have a timer with the interval you wish, when the timer triggers and if you are not connected, you will abort the thread.

0

精彩评论

暂无评论...
验证码 换一张
取 消