I created a socket program TCPClient and communicate to Server. The program is workable when run on the 1st time. But it will hang up on the code 'while ((result=in.readLine()) != null)'
Here is my program.
import java.net.*; import java.io.*;
public class TCPClient { String inputData, sendData; String tmpCode, ctlCode; int intCh; char ch; //private static String result; StringBuffer chkChr;
public void TCPsend(String passData) { try { int serverPort = 26001; String hostName = "172.19.1.111";
inputData = passData;
// Connet to the Server Socket s = new Socket(hostName, serverPort); DataOutputStream out = new DataOutputStream( s.getOutputStream()); BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
// add device control code (Hex 13 or ASCII 19)at the end of record tmpCode = " "; intCh = 19; ch = (char) intCh; StringBuffer word = new StringBuffer(tmpCode); word.setCharAt(0, ch); ctlCode = word.toString();