[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip ProtocolStack.java,1.13,1.14 Udp.java,1.23,1.2
Status: Beta
Brought to you by:
darkkey
From: gift <gi...@us...> - 2005-11-21 15:28:07
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16852/core/protocolsuite/tcp_ip Modified Files: ProtocolStack.java Udp.java Log Message: Can test now. Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ProtocolStack.java 20 Nov 2005 20:30:53 -0000 1.13 --- ProtocolStack.java 21 Nov 2005 15:27:53 -0000 1.14 *************** *** 1352,1356 **** { try{ ! mUDPprotocol.ListenPort(application,inPort); } catch (TransportLayerException te) --- 1352,1363 ---- { try{ ! mUDPprotocol.ListenPort(application,inPort); ! ! LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(getParentNodeName()); ! UDP_Info.setDataType("UDP Application"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("Application is now listening on port " + inPort + "."); ! Simulation.addLayerInfo(UDP_Info); } catch (TransportLayerException te) *************** *** 1358,1364 **** LayerInfo UDP_Info = new LayerInfo(getClass().getName()); UDP_Info.setObjectName(getParentNodeName()); ! UDP_Info.setDataType("UDP Packet"); UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP port listening: \""+ te.toString() + "\"."); Simulation.addLayerInfo(UDP_Info); } --- 1365,1371 ---- LayerInfo UDP_Info = new LayerInfo(getClass().getName()); UDP_Info.setObjectName(getParentNodeName()); ! UDP_Info.setDataType("UDP Application"); UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("Error: UDP port listening: \""+ te.toString() + "\"."); Simulation.addLayerInfo(UDP_Info); } Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Udp.java 21 Nov 2005 14:56:01 -0000 1.23 --- Udp.java 21 Nov 2005 15:27:53 -0000 1.24 *************** *** 568,573 **** if ( (lsPort=AlreadyListens(application)) == PORT_INIT ) ! { ! if (inPort>=0 && inPort<=10000) { --- 568,572 ---- if ( (lsPort=AlreadyListens(application)) == PORT_INIT ) ! { if (inPort>=0 && inPort<=10000) { *************** *** 598,608 **** if (UID1==UID2) { ! throw new TransportLayerException("UDP Error: already listening to port "+ inPort +"!"); ! } else throw new TransportLayerException("UDP Error: port "+ inPort +" is being listened to by another application! Can listen only to free ports." ); case 2: //port is busy => error ! throw new TransportLayerException("UDP Error: port "+ inPort +" is busy! Can listen only to free ports." ); // no "break" needed ;) default: //unknown port status ! throw new TransportLayerException("UDP Error: unknown port status! Port "+ inPort +" on host \""+ mParentStack.getParentNodeName()+"\"."); } --- 597,607 ---- if (UID1==UID2) { ! throw new TransportLayerException("error: already listening to port "+ inPort +"!"); ! } else throw new TransportLayerException("error: port "+ inPort +" is being listened to by another application! Can listen only to free ports." ); case 2: //port is busy => error ! throw new TransportLayerException("error: port "+ inPort +" is busy! Can listen only to free ports." ); // no "break" needed ;) default: //unknown port status ! throw new TransportLayerException("error: unknown port status! Port "+ inPort +" on host \""+ mParentStack.getParentNodeName()+"\"."); } *************** *** 618,638 **** PortTable.put(inPort,newElm); //hash table update } ! } else throw new TransportLayerException("UDP Error: can not listen to port "+ inPort +"! Use port range from 0 to 10000 to listen to."); ! } else throw new TransportLayerException("UDP Error: can not listen to port "+ inPort +"! Already listening to port " + lsPort + "."); ! /* { ! LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Packet"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP port listening: \"UDP Error: can not listen to port "+ inPort +"! Already listening to port " + lsPort + ".\"."); ! Simulation.addLayerInfo(UDP_Info); ! } */ ! LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Applicaion"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP application is now listening on UDP port "+ inPort +"."); ! Simulation.addLayerInfo(UDP_Info); } --- 617,648 ---- PortTable.put(inPort,newElm); //hash table update } ! } else // ! { ! /* LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Applicaion"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP port listening: \"UDP Error: can not listen to port "+ inPort +"! Use port range from 0 to 10000 to listen to."); ! Simulation.addLayerInfo(UDP_Info); */ ! throw new TransportLayerException("error: can not listen to port "+ inPort +"! Use port range from 0 to 10000 to listen to."); ! } ! } else // ! { ! /* LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Applicaion"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP port listening: \"UDP Error: can not listen to port "+ inPort +"! Already listening to port " + lsPort + ".\"."); ! Simulation.addLayerInfo(UDP_Info); */ ! if (lsPort==inPort) throw new TransportLayerException("error: can not double listen to port "+ inPort +"! Server is already listening to this port"); ! throw new TransportLayerException("error: can not listen to port "+ inPort +"! Already listening to port " + lsPort); ! } ! /* LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Applicaion"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP application is now listening on UDP port "+ inPort +"."); ! Simulation.addLayerInfo(UDP_Info); */ } |