• 大小: 2.44MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-05
  • 语言: 其他
  • 标签: 爱普生  打印  demo  C#  

资源简介

爱普生打印机网络打印、串口打印、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个文件信息

评论

共有 条评论