Error writing to connection: Broken pipe

// Expert user has replied.
V Vedsatx Saddvv 2 years 11 months ago
483 3 0

Hi!
I occasionally run into an issue where my Android is apparently paired (verified by looking in Android settings, and also had just accepted via the dialog on both the TC70 and the QLn320). Also, the Link.OS connection is connected and open (similar to below):
if (connection != null) {    if (!connection.IsConnected)        connection.Open ();
 
But when sending a connection.Write command, I receive an error:
Message: Error writing to connection: Broken pipe
 
Part of the stack trace:
at Zebra.Sdk.Comm.ConnectionA.Write (System.Byte[] p0) [0x0005c] in C:\repos\xamarin-sdk\Binding          Libraries\ZSDK_ANDROIDX\ZSDK_ANDROIDX\obj\Release\generated\src\Zebra.Sdk.Comm.ConnectionA.cs:921
at LinkOS.Plugin.ConnectionImplementation.Write (System.Byte[] data) [0x00000] in C:\repos\xamarin-sdk\Link_OS_SDK_for_Xamarin_Portable\LinkOS\LinkOS.Plugin.Android\ConnectionImplementation.cs:162
 
Any suggestions on how to handle this smoothly? Thanks!

Please register or login to post a reply

3 Replies

A Anderson Pinheiro

Hello, after 3 years ...
You can check the bluetooth connection.
I had the same issue and the problem was that the bluetooth connection was closed and reopened before the print connection was closed. So when I call the write method to print another string, the errors are thrown.
I solved the error by creating and closing the two connections together.

V Vedsatx Saddvv

Hi Peter,
This is usually caused by the printer powering off unexpectedly or going out of range.  I'm not sure if this applies to you.  The IsConnected() code shows it as open because the connection was not specifically closed properly (Android native functionality).  The way to handle this properly is to catch the exception and dispose of the connection object, then recreate it. 
Robin

M Manuel Caicedo-Rivera

Hi Peter,

Are you using the LINK-OS Xamarin component?  Otherwise, could you give us more details about the version of the LINK-OS you are using in your integration project. Also, The version of the firmware of the printer will be useful to analyze the context of the error generated.

Thanks,

MC

CONTACT
Can’t find what you’re looking for?