Click here to Skip to main content
15,908,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I try to send command via ethernet to the printer where are stored some files on memory card. Printer is a specific thermal printer Vario III. here is a inter manual: Uploadfiles.io - inter_vario3_uk.pdf[^]

Problem: Connectiong is probably OK but I dont known which format or how can I right send a functional command for this printer. When I try to send a command like:
private void button1_Click(object sender, EventArgs e)
       {
           Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
           clientSocket.NoDelay = true;

           IPAddress ip = IPAddress.Parse("192.168.11.117");
           IPEndPoint ipep = new IPEndPoint(ip, 9100);
           clientSocket.Connect(ipep);

           byte[] fileBytes = File.ReadAllBytes("153.874-003.lbex");

           clientSocket.Send(fileBytes);
           clientSocket.Close();
       }
without response. This command should be for change language according to inter manual, but nothing happen.

Thank you for advice

What I have tried:

I try to use this program and use some internal commands from guide Reading Data Directly from the Printer[^]
Posted
Updated 10-Feb-19 20:03pm
v3
Comments
Dave Kreskowiak 6-Feb-19 11:05am    
Ummm... the single line of code you posted doesn't send a command anywhere. It's not even a useful Format statement.

All you did was assign the string value "FCDI--r0-------" to the variable sendString.
Member 13711215 6-Feb-19 11:39am    
Hi, I improve my question. Now when I send this file, printer show me error. communication is OK. but now I want select file from printers memory card by name and print it. in printer is way A:\STANDARD\some file.

Talk to the printer manufacturer, they will know a lot more about their device than we will. It may be that the print driver is getting in the way, or you need to talk to the drive in some specific manner, we can't tell without exhaustive knowledge of the specific make and model - and 99% of us are not going to have even seen that model, much less used it for exactly what you are trying to do.

So talk to the manufacturers - they will either have tech support or possibly even sample code.
 
Share this answer
 
Comments
Member 13711215 6-Feb-19 11:19am    
I have arduino code if it helps.
OriginalGriff 6-Feb-19 11:31am    
Not to me, I don't have an Arduino ... so check it in your Arduino, and see if it works. If it does, then you have working code and non-working code and should be able to see the difference.
Member 13711215 7-Feb-19 11:21am    
Griff? Can you help me? How can I send to printer this command? <soh> FBC---r--------<etb>
OriginalGriff 7-Feb-19 14:05pm    
At the risk of repeating myself: "Talk to the printer manufacturer".
Public Sub print_file(ByVal sender As Object, ByVal e As EventArgs)

       'Nastavení komunikace IP ADRESA TISKÁRNY + PORT
       Dim clientSocket As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
       clientSocket.NoDelay = True
       Dim ip As IPAddress = IPAddress.Parse("192.168.11.117")
       Dim ipep As IPEndPoint = New IPEndPoint(ip, 9100)

       'Otevření spojení
       Try
           clientSocket.Connect(ipep)
       Catch ex As Exception
           MessageBox.Show(ex.Message)
       End Try

       'Načtení etikety dle ascii tabulky (SOH)FMB---rTEXTBOX1.TEXT(ETB)
       Dim s As String = Assy_line_light.split_char.Text
       Dim bytes = Encoding.ASCII.GetBytes(s)
       Dim bytesToSend As Byte() = New Byte(7) {&H1, &H46, &H4D, &H42, &H2D, &H2D, &H2D, &H52}
       Dim bytesToSend2 As Byte() = New Byte(0) {&H17}
       Dim load = bytesToSend.Concat(bytes).ToArray()
       Dim load2 = load.Concat(bytesToSend2).ToArray()

       Try
           clientSocket.Send(load2)
       Catch ex As Exception
           MessageBox.Show(ex.Message)
       End Try

       'Tisk etikety dle ascii tabulky (SOH)FBC---r--------(ETB)
       System.Threading.Thread.Sleep(500)
       Dim print As Byte() = New Byte(15) {&H1, &H46, &H42, &H44, &H2D, &H2D, &H2D, &H53, &H2D, &H2D, &H2D, &H2D, &H2D, &H2D, &H2D, &H17}

       Try
           clientSocket.Send(print)

       Catch ex As Exception
           MessageBox.Show(ex.Message)
       End Try

       'Uzavření spojení
       clientSocket.Close()
   End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900