各位大侠,请指点一下,
public PrintStream out;
out = new PrintStream(this.remoteConnection.getOutputStream());
out.append((char) 0xd);
out.flush();本来程序只发送一个'\r',但是抓包发现发送了'\d'+'\r'莫名其妙的多了一个'\d',导致程序有问题,请问哪位大侠知道为什么,如何解决,多谢。

解决方案 »

  1.   

    public void writeLine(String strValue) {
    // LOG.debug("IN writeLn " + strValue);
    if (out != null && strValue != null) {
    if (strValue.indexOf("\n") >= 0) {
    out.print(strValue);
    out.flush();
    } else {
    /* send /r */
    out.print(strValue + String.valueOf((char) 0xd));
    out.flush();
    }
    } }
    这个完整的代码比较多。第二行是可以获得的,并且Telnet连接也没有问题,现在是串口连接的时候有问题。也不知道为啥。