Hello all
Im making a listener which basically listens on a port for like forever and as soon as a client connects it then initiates a transfer in a manner such that the listener first sends out a string "@AUTH@" and then the clien responds and so on.
My code segment for the above is as follows
while(true){
try {
Socket incoming=connection.accept();
while(!incoming.isClosed())
{
out = new PrintWriter(incoming.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(incoming.getInputStream()));
BufferedInputStream is = new BufferedInputStream(incoming.getInputStream()); //inputstream to get data from the socket
BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
out.println("@AUTH@");
}
}
catch(Exception e){}
}
where 'connection' is an object of class ServerSocket. Now when im testing my code using the hyoperterminal, im like connecting to the port and on the first connection, the string "@AUTH@" is displayed but then once i disconnect from that port using Hyperterminal and connect again, the string "@AUTH@" is not displayed. I basically want this string to be displayed every time a client connects to that port as it acts as the initiation for the whole authorization process.
Any pointers would be of great help.
CHeers