2 sanpi199274 sanpi199274 于 2016.09.19 09:45 提问

如何用c#编写串口监控软件? 监控某个串口的数据接受和发送

例如:有个串口工具在和COM3通信,可以用 串口监控软件,监控它们的通信数据。
我用过serialPort试过,但serialPort.Open()打开后,其他串口工具就无法和COM3连接,提示被占用,如何解决即可以监控串口,但又不影响其他工具连接COM3进行通信。

AccessPort 串口监控工具可以实现这个功能,但不知道其怎么实现的,我需要把这个功能加到我自己的代码里面。

2个回答

devmiao
devmiao   Ds   Rxr 2016.09.19 09:46
qq_28510593
qq_28510593   2016.09.19 11:38

package com.oracle.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.oracle.domain.Book;
import com.oracle.domain.Category;
import com.oracle.service.BaseServlet;
import com.oracle.service.BookService;
import com.oracle.service.CategoryService;

public class BookServlet extends BaseServlet {
BookService bookService=new BookService();
public String findAll(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
List booklist = bookService.findAll();
request.setAttribute("booklist", booklist);
return "f:/jsps/book/list.jsp";
}
public String findByCid(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String cid = request.getParameter("cid");
List booklist = bookService.findByCid(cid);
request.setAttribute("booklist", booklist);
return "f:/jsps/book/list.jsp";
}

public String findByBid(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String bid = request.getParameter("bid");
     Book book = bookService.findByBid(bid);
     System.out.println(book);
    request.setAttribute("book", book);
    return "f:/jsps/book/desc.jsp";
}

}

Csdn user default icon
上传中...
上传图片
插入图片