DataLogger Application problem

Mash-Hud Iqbal <shawon21-/[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <[email protected]>
Dear everyone 

I am writing  once again as my problem has not been
solved yet. I have send couple of mails during xmas
time and the problem is the following. 
The error message and source code is given follwoing:



Error Message:

TINI /> java DataLogger1.tini 60 120 &
> Starting DataLogger ...
> TINI /> Here is the problem
> java.io.IOException: Unable to listen on
> ServerSocket
> No other stack trace info available.

Source code:

package bin;
import java.io.*;
import java.net.*;
class DataLogger extends Thread
{
//...
ServerSocket ss=null;
    static final int SERVER_PORT = 5713;
HumidityLogger logger;
DataLogger(int samples, int delay) throws
LoggingException
{
// Create and start the logging daemon
logger = new HumidityLogger(samples, delay);
logger.start();
/*try
{
ss = new ServerSocket(5713);
} catch (Exception ioe)
{
        System.out.println("Here is the problem" +
ioe.getMessage());
/*e.printStackTrace();
System.exit(1);

// Abort if we can't create ServerSocket instance
return;*/


}
//...
public static void main(String[] args)
{


System.out.println("Starting DataLogger ...");
if (args.length != 2)
{
System.out.println("Usage: java DataLogger samples
delay");
System.exit(1);

}
int samples = Integer.parseInt(args[0]);
int delay = Integer.parseInt(args[1]);
try
{
(new DataLogger(samples, delay)).start();
}
catch (Exception e)
{
System.out.println("Error creating data logger");
e.printStackTrace();
// In case any non-daemon threads have been started
// System.exit(1);
}
}
public void run()
{
//int SERVER_PORT=5588;

ServerSocket ss=null;
try
{
    ss = new ServerSocket(SERVER_PORT);
}
catch (Exception e)
{
        System.out.println("Here is the problem");
e.printStackTrace();
System.exit(1);

// Abort if we can't create ServerSocket instance
return;

}
Socket s = null;
while (true)
{

try
{
// Wait for client connections over PPP or Ethernet
s = ss.accept();
} catch (IOException ioe)
{
// Shut down the logging daemon
logger.stopLogging();
System.out.println("Fatal problem with server
socket");
ioe.printStackTrace();
// Fall out of run method
break;
}
// Create a new thread to handle this connection
(new LogWorker(s)).start();
}


}




 private class LogWorker extends Thread
  {
private Socket s;
private LogWorker(Socket s)
{
this.s = s;
}
public void run()
{
DataOutputStream dout = null;
try
{
dout = new DataOutputStream(new
BufferedOutputStream(s.getOutputStream()));
logger.writeLog(dout);
dout.flush();
} catch (IOException ioe)
{
System.out.println("I/O error writing log data");
ioe.printStackTrace();
} finally
{
try
{
s.close();
dout.close();
} catch (IOException e) {}
}
}
  }




}


in the code the "run()" method it is not in fact
creating the ServerSocket whose instance is "ss". Plz
help me out about this.

I have done couple of tests as u told me to before.

TINI /> netstat
Connection count: 4
   Local Port   Remote Port   Remote IP         State
1:         23          ----   ---------         LISTEN
2:         21          ----   ---------         LISTEN
3:       5713          ----   ---------         LISTEN
4:         23          3245   192.168.0.1
ESTABLISHED

and for the stats-v command I have seen the following
results:

TINI /> stats -v

TINI slush Version 1.02e
TINI OS 1.02e
DS TINI Model 390 Rev D DSTINI1-1MG
S/N 475E70005D3FF689

System up time:
      Days: 0
     Hours: 0
   Minutes: 0
   Seconds: 0

Free RAM: 733248

FTP Server   :active
Telnet Server:active
Serial Server:active

Last Boot Status:
   Network Restored from Flash: no
         Master Erase Occurred: no
           Heap Clear Occurred: no
          File System Modified: no

TINI />

So from the netstat command I can see the local port
from 5713 it is listening but while I run the
Datalogger application it can;'t open the ServerSocket
and giving me the error. for you here is the ocde
again and the error message again:

Plz help me out. I am in such a problem. I don't know
what to do. I can't move further unless this problem
is solved. Plzzz do some thing for me. PLZ PLZ
PLZ.....

Regards

Mash-Hud

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.