lrgs.noaaportrecv.NoaaportTestSvrThread Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opendcs Show documentation
Show all versions of opendcs Show documentation
A collection of software for aggregatting and processing environmental data such as from NOAA GOES satellites.
The newest version!
package lrgs.noaaportrecv;
import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
import ilex.gui.JobDialog;
import ilex.net.BasicServer;
import ilex.net.BasicSvrThread;
public class NoaaportTestSvrThread extends BasicSvrThread {
private JobDialog myDialog;
private Socket mySocket;
NoaaportTestSvrThread(BasicServer parent, Socket socket, JobDialog mydialog)
{
super(parent, socket);
myDialog = mydialog;
mySocket=socket;
myDialog.addToProgress("New Client Connected");
}
@Override
protected void serviceClient() {
if(mySocket.isConnected())
{
InputStream mystream = null;
try {
mystream = mySocket.getInputStream();
int readInt = mystream.read();
if(readInt<0)
{
this.disconnect();
myDialog.addToProgress("\nClient Dissconnected");
parent.rmSvrThread(this);
return;
}
myDialog.addToProgressNLF(String.valueOf((char)readInt));
} catch (IOException e) {
myDialog.addToProgress("IO Error "+ e.getMessage());
myDialog.finishedJob();
this.disconnect();
return;
}
}
}
}