資源簡介
愛普生打印機網絡打印、串口打印、USB口打印,親測可用、請放心使用、有問題直接聯系我

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.IO;
using?System.Net;
using?System.Net.Sockets;
//using?System.Threading;?不含讀操作
namespace?Serial_ESCPOS
{
????public?partial?class?Form1?:?Form
????{
????????Socket?c?=?null;
????????String?str_ip?=?null;
????????int?port?=?9100;
????????
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?buttonOK_Click(object?sender?EventArgs?e)
????????{
????????????Application.Exit();
????????}
????????private?void?statusStrip1_ItemClicked(object?sender?ToolStripItemClickedEventArgs?e)
????????{
????????}
????????private?void?buttonOpenPort_Click(object?sender?EventArgs?e)
????????{
????????????//?IP地址檢查
????????????if?((numericUpDown1.Value?!=?10)
????????????????&&?(numericUpDown1.Value?!=?172)?&&?(numericUpDown1.Value?!=?192))
????????????{
????????????????MessageBox.Show(“私有IP地址允許的網段范圍是:\n“
????????????????????????????????+?“10.0.0.0--10.255.255.255\n“
????????????????????????????????+?“172.16.0.0--172.31.255.255\n“
????????????????????????????????+?“192.168.0.0--192.168.255.255\n“);
????????????}
????????????else?if?((numericUpDown1.Value?==?172)
?????????????????&&?((numericUpDown2.Value?16)?||?(numericUpDown2.Value?>?31)))
????????????{
????????????????MessageBox.Show(“私有IP地址允許的網段范圍是:\n“
????????????????????????????????+?“172.16.0.0--172.31.255.255\n“);
????????????}
????????????else?if?((numericUpDown1.Value?==?192)?&&?(numericUpDown2.Value?!=?168))
????????????{
????????????????MessageBox.Show(“私有IP地址允許的網段范圍是:\n“
????????????????????????????????+?“192.168.0.0--192.168.255.255\n“);
????????????}
????????????else
????????????{
????????????????//?Connect?this?IP?address?on?TCP?Port9100
????????????????str_ip?=?numericUpDown1.Value?+?“.“?+?numericUpDown2.Value?+?“.“
???????????????????????+?numericUpDown3.Value?+?“.“?+?numericUpDown4.Value;
????????????????IPAddress?ip?=?IPAddress.Parse(str_ip);
????????????????try
????????????????{
????????????????????//把ip和端口轉化為IPEndPoint實例
????????????????????IPEndPoint?ip_endpoint?=?new?IPEndPoint(ip?port);
????????????????????//創建一個Socket
????????????????????c?=?new?Socket(AddressFamily.InterNetwork?SocketType.Stream?ProtocolType.Tcp);
????????????????????//連接到服務器
????????????????????c.Connect(ip_endpoint);
????????????????????//應對同步Connect超時過長的辦法,猜測應該是先用異步方式建立以個連接然后,
????????????????????//確認連接是否可用,然后報錯或者關閉后,重新建立一個同步連接????????????????????
????????????????????c.SendTimeout?=?1000;
????????????????????//初始化打印機,并打印
????????????????????ipWrite(“\x1b\x40打開TCP/IP連接!\n-------------------------------\n\n“);
????????????????????//操作按鈕啟用
????????????????????buttonClosePort.Enabled?=?true;
????????????????????buttonOpenPort.Enabled?=?false;
????????????????????button1.Enabled?=?tr
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.????209920??2018-05-08?00:06??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\.vs\EtherNet_forT82\v14\.suo
?????文件??????11600??2011-07-05?16:24??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\bin\Debug\EtherNet_ESCPOS_barcode.vshost.exe
?????文件????????490??2010-03-17?22:39??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\bin\Debug\EtherNet_ESCPOS_barcode.vshost.exe.manifest
?????文件???????3778??2011-07-05?16:24??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\EtherNet_ESCPOS_barcode.csproj
?????文件??????43109??2012-01-19?16:17??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\Form1.cs
?????文件??????17506??2012-01-19?16:17??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\Form1.Designer.cs
?????文件??????18640??2012-01-19?16:17??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\Form1.resx
?????文件???????2152??2011-07-05?16:03??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????7507??2018-05-08?00:05??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????494??2010-07-22?13:35??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\Program.cs
?????文件???????1378??2011-07-05?16:03??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\Properties\AssemblyInfo.cs
?????文件???????2896??2011-07-05?16:03??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\Properties\Resources.Designer.cs
?????文件???????5612??2011-07-05?16:03??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\Properties\Resources.resx
?????文件???????1108??2011-07-05?16:03??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\Properties\Settings.Designer.cs
?????文件????????249??2011-07-05?16:03??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\Properties\Settings.settings
?????文件???????8209??2011-06-01?13:31??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_barcode\tm-t82_i26.jpg
?????文件??????11600??2011-07-05?16:36??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\bin\Debug\EtherNet_ESCPOS_bitmap.vshost.exe
?????文件????????490??2010-03-17?22:39??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\bin\Debug\EtherNet_ESCPOS_bitmap.vshost.exe.manifest
?????文件???????3776??2011-07-05?16:26??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\EtherNet_ESCPOS_bitmap.csproj
?????文件??????26200??2012-01-19?16:17??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\Form1.cs
?????文件??????30280??2012-01-19?16:17??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\Form1.Designer.cs
?????文件??????18640??2012-01-19?16:17??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\Form1.resx
?????文件???????7503??2018-05-08?00:05??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????494??2010-07-30?13:52??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\Program.cs
?????文件???????1376??2011-07-05?16:22??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\Properties\AssemblyInfo.cs
?????文件???????2894??2011-07-05?16:22??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\Properties\Resources.Designer.cs
?????文件???????5612??2011-07-05?16:22??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\Properties\Resources.resx
?????文件???????1107??2011-07-05?16:22??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\Properties\Settings.Designer.cs
?????文件????????249??2011-07-05?16:22??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\Properties\Settings.settings
?????文件???????8209??2011-06-01?13:31??ESCPOS_byCSharp2010_forT82\EtherNet_forT82\EtherNet_ESCPOS_bitmap\tm-t82_i26.jpg
............此處省略739個文件信息
- 上一篇:運控課件第一、二、三、四、五章
- 下一篇:企業局域網設計
評論
共有 條評論