11package net .sharksystem .asap .cmdline ;
22
3+ import net .sharksystem .utils .Log ;
4+
35import java .io .IOException ;
46import java .io .InputStream ;
57import java .io .OutputStream ;
@@ -58,7 +60,7 @@ public void kill() {
5860 this .tcpServer .kill ();
5961 }
6062 } catch (IOException e ) {
61- System . err . println ( "TCPChannel: problems while killing: " + e .getLocalizedMessage ());
63+ Log . writeLogErr ( this , "TCPChannel: problems while killing: " + e .getLocalizedMessage ());
6264 }
6365 }
6466
@@ -67,8 +69,8 @@ public void run() {
6769 this .createThread = Thread .currentThread ();
6870 try {
6971 if (this .asServer ) {
70- System . out . println (
71- "TCPChannel: note: this implementation will only accept *one* connection attempt as server" );
72+ Log . writeLog ( this ,
73+ "TCPChannel: note: this implementation will only accept *one* connection attempt as server" );
7274 this .tcpServer = new TCPServer ();
7375 this .socket = tcpServer .getSocket ();
7476 } else {
@@ -83,7 +85,7 @@ public void run() {
8385 } catch (IOException ex ) {
8486 //<<<<<<<<<<<<<<<<<<debug
8587 String s = "couldn't establish connection" ;
86- System . out . println ( s );
88+ Log . writeLog ( this , s );
8789 this .fatalError = true ;
8890 }
8991 }
@@ -92,7 +94,7 @@ public void close() throws IOException {
9294 if (this .socket != null ) {
9395 this .socket .close ();
9496 //<<<<<<<<<<<<<<<<<<debug
95- System . out . println ( "socket closed" );
97+ Log . writeLog ( this , "socket closed" );
9698 }
9799 }
98100
@@ -142,7 +144,7 @@ public void checkConnected() throws IOException {
142144 if (this .socket == null ) {
143145 //<<<<<<<<<<<<<<<<<<debug
144146 String s = "no socket yet - should call connect first" ;
145- System . out . println ( s );
147+ Log . writeLog ( this , s );
146148 //>>>>>>>>>>>>>>>>>>>debug
147149 throw new IOException (s );
148150 }
@@ -174,7 +176,7 @@ Socket getSocket() throws IOException {
174176 b .append ("opened port " );
175177 b .append (port );
176178 b .append (" on localhost and wait" );
177- System . out . println ( b .toString ());
179+ Log . writeLog ( this , b .toString ());
178180 //>>>>>>>>>>>>>>>>>>>debug
179181
180182 Socket socket = this .srvSocket .accept ();
@@ -184,7 +186,7 @@ Socket getSocket() throws IOException {
184186 b .append (name );
185187 b .append ("): " );
186188 b .append ("connected" );
187- System . out . println ( b .toString ());
189+ Log . writeLog ( this , b .toString ());
188190 //>>>>>>>>>>>>>>>>>>>debug
189191
190192 return socket ;
@@ -212,7 +214,7 @@ Socket getSocket() throws IOException {
212214 b .append ("): " );
213215 b .append ("try to connect localhost port " );
214216 b .append (port );
215- System . out . println ( b .toString ());
217+ Log . writeLog ( this , b .toString ());
216218 //>>>>>>>>>>>>>>>>>>>debug
217219 Socket socket = new Socket ("localhost" , port );
218220 return socket ;
@@ -225,7 +227,7 @@ Socket getSocket() throws IOException {
225227 b .append ("): " );
226228 b .append ("failed / wait and re-try" );
227229 b .append (port );
228- System . out . println ( b .toString ());
230+ Log . writeLog ( this , b .toString ());
229231 try {
230232 Thread .sleep (waitInMillis );
231233 } catch (InterruptedException ex ) {
0 commit comments