Answer the question
In order to leave comments, you need to log in
How can I connect to a printer on the same network using an IP address?
There is a printer that is located on the same network and it has its own address and port, how can I connect to it in order to print the file in the future?
public class TiskActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tisk);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
try {
methodClass();
} catch (Exception e) {
e.printStackTrace();
}
}
public void methodClass() throws Exception {
Socket clientSocket = new Socket("192.168.46.83", 9100);
DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
//The data being sent in the lines below illustrate CPCL one can change the data for the corresponding
//language being used (ZPL, EPL)
System.out.println(clientSocket.isConnected());
outToServer.writeBytes("test");
clientSocket.close();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question