Update of /cvsroot/javanetsim/javaNetSim/guiUI
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1477/guiUI
Modified Files:
ApplicationLayerDevice.java MainScreen.java
Log Message:
Index: MainScreen.java
===================================================================
RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** MainScreen.java 9 Feb 2006 23:12:39 -0000 1.29
--- MainScreen.java 22 Feb 2006 16:29:30 -0000 1.30
***************
*** 122,127 ****
import core.protocolsuite.tcp_ip.Echo_tcp;
import core.protocolsuite.tcp_ip.SNMP;
!
!
--- 122,127 ----
import core.protocolsuite.tcp_ip.Echo_tcp;
import core.protocolsuite.tcp_ip.SNMP;
! import core.protocolsuite.tcp_ip.Telnet_server;
! import core.protocolsuite.tcp_ip.Telnet_client;
***************
*** 3002,3005 ****
--- 3002,3032 ----
}
+ public void TelnetListen(String inNodeName){
+
+ String port = JOptionPane.showInputDialog(this, "Port:", "Set Telnet Server listening on port.", JOptionPane.QUESTION_MESSAGE);
+
+ if(port!=null){
+
+ try{
+
+
+
+ Telnet_server telnet1 = ((Telnet_server)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(23));
+
+ telnet1.setPort(Integer.valueOf(port).intValue());
+
+ telnet1.Listen();
+
+ printLayerInfo(true);
+
+ }catch(Exception e){
+
+ addToConsole(e.toString());
+
+ }
+
+ }
+
+ }
/**
***************
*** 3145,3148 ****
--- 3172,3211 ----
}
+
+
+ public void TelnetConnect(String inNodeName){
+
+ String ip = JOptionPane.showInputDialog(this, "Server IP:", "Send msg over Echo.", JOptionPane.QUESTION_MESSAGE);
+
+ String port = JOptionPane.showInputDialog(this, "Server Port:", "Send msg over Echo.", JOptionPane.QUESTION_MESSAGE);
+
+ if(port!=null && ip!=null){
+
+ try{
+
+ printNetworkStart();
+
+ //Timer timer = null;
+ //timer=new Timer();
+ //timer.schedule(new TTask(this, 1),4000,4000);
+ //=<150
+ //((Echo_tcp)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(30021)).SendEcho(msg, ip, Integer.valueOf(port).intValue(), Integer.valueOf(cnt).intValue());
+ TelnetEmulator t = new TelnetEmulator(((Telnet_client)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(30023)),ip,Integer.valueOf(port).intValue());
+ t.pack();
+ t.setVisible(true);
+ //
+ //this.addToConsole("Trying to send echo message '" + msg + "' from " + inNodeName + " to " + ip + ":" + port + "\n");
+
+ }catch(Exception e){
+
+ addToConsole(e.toString());
+
+ }
+ addHeader();
+ printLayerInfo(false);
+
+ }
+
+ }
/**
Index: ApplicationLayerDevice.java
===================================================================
RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/ApplicationLayerDevice.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ApplicationLayerDevice.java 9 Feb 2006 23:12:39 -0000 1.6
--- ApplicationLayerDevice.java 22 Feb 2006 16:29:30 -0000 1.7
***************
*** 26,29 ****
--- 26,31 ----
private JMenuItem mnuEchotcpListen = new JMenuItem("Start tcp echo server to listen.");
private JMenuItem mnuEchotcpSend = new JMenuItem("Send data via tcp echo client.");
+ private JMenuItem mnuTelnetListen = new JMenuItem("Start telnet server to listen.");
+ private JMenuItem mnuTelnetConnect = new JMenuItem("Telnet client.");
private JMenu mnuAppLayer = new JMenu("Applications");
private JMenuItem mnuSNMPAgent = new JMenuItem("Start SNMP agent");
***************
*** 80,86 ****
--- 82,102 ----
}
});
+ mnuTelnetListen.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e){
+ controller.TelnetListen(lblNodeName.getText());
+ }
+ });
+
+ mnuTelnetConnect.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e){
+ controller.TelnetConnect(lblNodeName.getText());
+ }
+ });
mnuAppLayer.addSeparator();
mnuAppLayer.add(mnuSNMPAgent);
mnuAppLayer.add(mnuSNMPManager);
+ mnuAppLayer.addSeparator();
+ mnuAppLayer.add(mnuTelnetListen);
+ mnuAppLayer.add(mnuTelnetConnect);
}
}
|