mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-22 12:51:09 +02:00
Add port as for simple-netty-server
This commit is contained in:
parent
f1a2d0ed1b
commit
9d7e4be4af
@ -18,7 +18,8 @@ import org.slf4j.LoggerFactory;
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void startStandalone(String[] args) throws Exception {
|
public static void startStandalone(String[] args) throws Exception {
|
||||||
NettyMessagingService server = new NettyMessagingService(8081);
|
int port = args.length > 0 ? Integer.parseInt(args[0]) : 8081;
|
||||||
|
NettyMessagingService server = new NettyMessagingService(port);
|
||||||
server.activate();
|
server.activate();
|
||||||
server.registerHandler("simple", new NettyLoggingHandler());
|
server.registerHandler("simple", new NettyLoggingHandler());
|
||||||
server.registerHandler("echo", new NettyEchoHandler());
|
server.registerHandler("echo", new NettyEchoHandler());
|
||||||
|
@ -14,22 +14,15 @@ import org.onlab.onos.cli.AbstractShellCommand;
|
|||||||
public class SimpleNettyServerCommand extends AbstractShellCommand {
|
public class SimpleNettyServerCommand extends AbstractShellCommand {
|
||||||
|
|
||||||
//FIXME: Replace these with parameters for
|
//FIXME: Replace these with parameters for
|
||||||
@Argument(index = 0, name = "serverIp", description = "Server IP address",
|
@Argument(index = 0, name = "port", description = "Port to listen",
|
||||||
required = false, multiValued = false)
|
required = false, multiValued = false)
|
||||||
String serverIp = "127.0.0.1";
|
String port = "8081";
|
||||||
|
|
||||||
@Argument(index = 1, name = "workers", description = "IO workers",
|
|
||||||
required = false, multiValued = false)
|
|
||||||
String workers = "6";
|
|
||||||
|
|
||||||
@Argument(index = 2, name = "messageLength", description = "Message length (bytes)",
|
|
||||||
required = false, multiValued = false)
|
|
||||||
String messageLength = "128";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute() {
|
protected void execute() {
|
||||||
try {
|
try {
|
||||||
startStandalone(new String[]{serverIp, workers, messageLength});
|
startStandalone(new String[]{port});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
error("Unable to start server %s", e);
|
error("Unable to start server %s", e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user