Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.net.*;
- import java.io.*;
- import java.util.*;
- class GcodeSender {
- public static void main(String[] args) throws Exception {
- Socket s=new Socket("192.168.1.19",23);
- PrintWriter pw = new PrintWriter(s.getOutputStream(),true);
- Scanner inp = new Scanner(s.getInputStream() );
- File f=new File(args[0]);
- Scanner sc = new Scanner(f);
- int i,j=0;
- while(sc.hasNextLine()) {
- String line = sc.nextLine().trim();
- if(line.startsWith("(") || line.startsWith(";") || line.length()==0) continue;
- if((i=line.indexOf(";"))>0) line=line.substring(0,i);
- pw.println( line ); System.out.print(++j+"> "+ line+" : " );
- do {
- line = inp.nextLine();
- System.out.println(line);
- } while(!line.equals("ok"));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement