[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip Application.java,1.13,1.14 Echo_tcp.java,1.16,
Status: Beta
Brought to you by:
darkkey
|
From: gift <gi...@us...> - 2005-12-08 19:35:18
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9065/core/protocolsuite/tcp_ip Modified Files: Application.java Echo_tcp.java Tcp.java Log Message: no comments Index: Application.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Application.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Application.java 27 Nov 2005 20:14:11 -0000 1.13 --- Application.java 8 Dec 2005 19:35:07 -0000 1.14 *************** *** 73,77 **** */ ! public abstract void Disconnect()throws TransportLayerException; /** --- 73,77 ---- */ ! public abstract void Disconnect()throws TransportLayerException, LowLinkException; /** Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Tcp.java 7 Dec 2005 13:24:51 -0000 1.27 --- Tcp.java 8 Dec 2005 19:35:07 -0000 1.28 *************** *** 1249,1252 **** --- 1249,1253 ---- { ClosePort((Application)Elm.application); //FIN sent and confirmed!!! Closing connection in case isPassive==true + ((Application)Elm.application).Listen(); } // Active application has to disconnect by calling Application.Disconnect(); Index: Echo_tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo_tcp.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Echo_tcp.java 8 Dec 2005 19:04:23 -0000 1.16 --- Echo_tcp.java 8 Dec 2005 19:35:07 -0000 1.17 *************** *** 46,50 **** //throw new TransportLayerException("Cannot bind port " + listenPort + "."); try{ ! mParentStack.ListenTCP(this, listenPort); } catch (TransportLayerException e) { --- 46,50 ---- //throw new TransportLayerException("Cannot bind port " + listenPort + "."); try{ ! if(appType == 1) mParentStack.ListenTCP(this, listenPort); } catch (TransportLayerException e) { *************** *** 113,117 **** */ ! public void Disconnect() throws TransportLayerException { mParentStack.CloseTCP(this); //mParentStack.freeTCPPort(this); --- 113,130 ---- */ ! public void Disconnect() throws TransportLayerException, LowLinkException{ ! try { ! mParentStack.FinalizeTCP(this); //will close client connection ! }catch(Exception e){ ! ///*TODO*: here to catch ! } ! ! LayerInfo protInfo3 = new LayerInfo(getClass().getName()); ! protInfo3.setObjectName(mParentStack.getParentNodeName()); ! protInfo3.setDataType("Echo Protocol Data"); ! protInfo3.setLayer("Application "); ! protInfo3.setDescription("Application closing connection. Now listening on " + listenPort + "."); ! Simulation.addLayerInfo(protInfo3); ! mParentStack.CloseTCP(this); //mParentStack.freeTCPPort(this); *************** *** 161,168 **** protInfo.setDescription("Recieving echo message '" + Data + "' from server."); Simulation.addLayerInfo(protInfo);*/ ! //Disconnect(); }else{ //server processing recieve ! try{ LayerInfo protInfo = new LayerInfo(getClass().getName()); protInfo.setObjectName(mParentStack.getParentNodeName()); --- 174,182 ---- protInfo.setDescription("Recieving echo message '" + Data + "' from server."); Simulation.addLayerInfo(protInfo);*/ ! Disconnect(); ! }else{ //server processing recieve ! LayerInfo protInfo = new LayerInfo(getClass().getName()); protInfo.setObjectName(mParentStack.getParentNodeName()); *************** *** 178,200 **** protInfo2.setDescription("Sending echo message '" + Data + "' to client."); Simulation.addLayerInfo(protInfo2); ! SendData(Data); ! mParentStack.FinalizeTCP(this); //will close client connection ! ! LayerInfo protInfo3 = new LayerInfo(getClass().getName()); ! protInfo3.setObjectName(mParentStack.getParentNodeName()); ! protInfo3.setDataType("Echo Protocol Data"); ! protInfo3.setLayer("Application "); ! protInfo3.setDescription("Server closing connection. Now listening on " + listenPort + "."); ! Simulation.addLayerInfo(protInfo3); ! ! Disconnect(); ! Listen(); ! ! }catch(Exception e){ ! ///*TODO*: here to catch ! } } } --- 192,204 ---- protInfo2.setDescription("Sending echo message '" + Data + "' to client."); Simulation.addLayerInfo(protInfo2); ! try { SendData(Data); + }catch(Exception e){ + ///*TODO*: here to catch + } ! // Disconnect(); ! // Listen(); } } |