[xSocket-develop] Error on listening 0.0.0.0
Status: Inactive
Brought to you by:
grro
|
From: Ciccio A. <alt...@gm...> - 2009-05-13 10:58:21
|
Hello!
Nice to write here.
I have a simple question to ask you.
First times i started xSocket on the 8090 port i got this message:
13-mag-2009 12.54.47 org.xsocket.connection.Server$LifeCycleHandler
onConnected
INFO: server listening on 127.0.0.1:8090 (xSocket 2.4.6)
and everything worked fine.
Now... when i run my app i get this message:
13-mag-2009 12.54.47 org.xsocket.connection.Server$LifeCycleHandler
onConnected
INFO: server listening on 0.0.0.0:8090 (xSocket 2.4.6)
and, obviously, nothin' works anymore.
What can it be??
this is my code:
import org.xsocket.connection.*;
public class Connessione
{
protected static IServer srv = null;
public static void main(String[] args)
{
try
{
srv = new Server(8090, new xSocketDataHandler());
srv.run();
srv.start();
}
catch(Exception ex)
{
System.out.println(ex.getMessage());
}
}
protected static void shutdownServer()
{
try
{
srv.close();
}
catch(Exception ex)
{
System.out.println(ex.getMessage());
}
}
}
And this is my other class.
import java.io.IOException;
import java.nio.BufferUnderflowException;
import java.nio.channels.ClosedChannelException;
import org.xsocket.*;
import org.xsocket.connection.*;
public class xSocketDataHandler implements IDataHandler
{
public boolean onData(INonBlockingConnection nbc) throws IOException,
BufferUnderflowException, ClosedChannelException,
MaxReadSizeExceededException
{
try
{
String data = nbc.readStringByDelimiter("\0");
nbc.write(data + "\0");
if(data.equalsIgnoreCase("SHUTDOWN"))
Connessione.shutdownServer();
}
catch(Exception ex)
{
System.out.println(ex.getMessage());
}
return true;
}
}
It's like how it is done in the tutorial.
Any idea?
Many thanks!
Cheers from Italy.
|