虚拟端口驱动 [英] Virtual comport driver

查看:136
本文介绍了虚拟端口驱动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我必须编写驱动程序,它是虚拟comport,当将数据写入com端口时,会通过套接字将数据发送到某些服务器.
我在DDK中使用Microsoft示例进行虚拟通讯.我的想法是使用回调函数来写入和读取IRP,并在此函数中通过套接字调用Send和recv.问题是recv正在阻止,并且如果没有数据从服务器进行通讯将阻止该过程.
我该如何解决这个问题?
我不知道我的方法正确吗?


Hi,
I have to write driver, which is virtual comport and when writes data to com port sends this data to some server over sockets.
I used Microsoft sample in DDK for virtual comport. My idea is to use callback functions for write and read IRP, and in this function to call Send and recv over socket. The problem is that recv is blocking and will block the process if there is no data from server to comport.
How do I resolve this problem?
I don''t know if my method of approach is correct?


Thanks!

推荐答案

Boris Borisov写道:
Boris Borisov wrote:

我的想法是使用回调函数用于写入和读取IRP,并在此函数中调用通过套接字发送和接收.

My idea is to use callback functions for write and read IRP, and in this function to call Send and recv over socket.


您不能使用线程吗?


Cannot you use threads?


问题已解决.我使用select()函数对套接字进行非阻塞读取.
Problem solved. I use select() function for non-blocking read from socket.


这篇关于虚拟端口驱动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆