public void free(int sock) throws TransportLayerException{
        jnSocket jnsock = sockTable.get(sock);
        jnsock.app = null;
        if(jnsock.open_state){
            if(jnsock.type == jnSocket.UDP_socket){
                mParentStack.UDP().closePort(sock);
            }
            else if(jnsock.type == jnSocket.TCP_socket){
                mParentStack.TCP().closePort(sock);
            }
            jnsock.open_state = false;
        }        
        jnsock.src_port = 0;
        jnsock.src_IP = "";
        sockTable.remove(sock);
    }