Hello, I've written a small piece of code for printing to a network printer. During testing, everything worked smoothly except from one point where i received this java error message: 'java.net.NoRouteToHostException: No route to host'.
Now, I know that maybe this has nothing to do with basic4android, still I would prefer to ask for your opinion, since this is the first time I tried to write such code, which goes like this:
sub button_Click
Socket1.Initialize("Socket1")
Socket1.Connect ("printer's ip",port,ms)
end Sub
Sub Socket1_Connected (Successful As Boolean)
If Successful = False Then
Msgbox(LastException.Message, "Error connecting")
Return
End If
Dim sb As StringBuilder
Dim tr2 As TextWriter
Dim s As String
sb.Initialize
sb.Append ("my text and escape codes")
s=sb.ToString
tr2.Initialize2 (Socket1.OutputStream,"my encoding")
tr2.WriteLine (s)
tr2.close
Socket1.Close
end Sub
I wonder if there is something wrong which makes the procedure unstable or it was just a temporary failure of my local network (since this thing happened just once in about 50+ tests), in which case probably I have to asign static IPs to my tablets. Any idea?
Now, I know that maybe this has nothing to do with basic4android, still I would prefer to ask for your opinion, since this is the first time I tried to write such code, which goes like this:
sub button_Click
Socket1.Initialize("Socket1")
Socket1.Connect ("printer's ip",port,ms)
end Sub
Sub Socket1_Connected (Successful As Boolean)
If Successful = False Then
Msgbox(LastException.Message, "Error connecting")
Return
End If
Dim sb As StringBuilder
Dim tr2 As TextWriter
Dim s As String
sb.Initialize
sb.Append ("my text and escape codes")
s=sb.ToString
tr2.Initialize2 (Socket1.OutputStream,"my encoding")
tr2.WriteLine (s)
tr2.close
Socket1.Close
end Sub
I wonder if there is something wrong which makes the procedure unstable or it was just a temporary failure of my local network (since this thing happened just once in about 50+ tests), in which case probably I have to asign static IPs to my tablets. Any idea?