|  
 
 
用C#写了一个WEB,功能:用斑马打印机(105SL)打印条码。代码如下: public static    void   Print_PENO(string ZPLString, string ipAddress)         {//ZPLString是机器码,ipAddress是打印机IP             int port = 9100;                          try             {                 // Open connection                 System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();                 client.Connect(ipAddress, port);                 // Write ZPL String to connection                 System.IO.StreamWriter writer = new System.IO.StreamWriter(client.GetStream());                 writer.Write(ZPLString);                 writer.Flush();                 // Close Connection                 writer.Close();                 client.Close();                           }             catch (Exception ex)             {                 throw ex;                          }         } 调用后,执行到ter.Flush();出错:Unable to write data to the transport connection: 遠端主機已強制關閉一個現存的連線。 
你不是把串口的指令发给以太网口了吧  
居然是IP衝突。 怎麼找都找不到原因,一氣之下,把列印機關了,怎么还能PING的通。  
 |