【解決方法】videojet dataflex 6330 プリンターに情報を送信する

[ad_1]

I am using the C# language to send information to the VideoJet Dataflex 6330 printer, but without success the printer is not receiving the information that I am sending.

The code I'm using is the following:

private void btnTeste_Click(object sender, EventArgs e)
{
    string msg = "";
    int _Port = 0;

    try
    {
        _Port = Convert.ToInt32(txtPort.Text);
        msg = GetVideoJet();
        MessageBox.Show(msg);

        IPAddress ipAddr = System.Net.IPAddress.Parse(txtIP.Text);
        IPEndPoint localEndPoint = new IPEndPoint(ipAddr, _Port);
        Socket senderMsg = new Socket(ipAddr.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
        senderMsg.Connect(localEndPoint);

        byte[] messageSent = Encoding.ASCII.GetBytes(msg);
        int byteSent = senderMsg.Send(messageSent);

        byte[] messageReceived = new byte[1024];
        int byteRecv = senderMsg.Receive(messageReceived);

        msg = $"Message from Server -> {Encoding.ASCII.GetString(messageReceived, 0, byteRecv)}";
        senderMsg.Shutdown(SocketShutdown.Both);
        senderMsg.Close();
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

private string GetVideoJet()
{
    string _ret = "SLA|TESTE";
    _ret += "|FORNECEDOR=" + txtFornecedor.Text;
    _ret += "|PRODUCAO=" + txtProducao.Text;
    _ret += "|SEMANA=" + txtSemana.Text;
    _ret += "|DIA=" + txtDia.Text;
    _ret += "|<CR>";

    return _ret;
}
Can anyone help me and have had this problem

私が試したこと:

What I've tried is not to convert the string into bytes and what I hope is that someone here on the forum has already had this problem and can help me. Thanks.

解決策 1

メーカーに相談してください。メーカーの技術サポートは、私たちよりもハードウェアに精通しており、基本的なスターターとしてすぐに使用できるサンプル コードを持っている可能性があります。

[ad_2]

コメント

タイトルとURLをコピーしました