#  client-server-1.dml
#
#  a simple two-host network running a trivial client/server protocol using TCP transport. 
#  At a random time in the interval (10 sec, 20 sec) of simulated time the client opens
#  a TCP connection to server and requests integer number "file_size" bytes of data.
#  The server will do just that. That's it.
#
#  server                              client
#             100 Mbs / 2 ms delay 
#  1(0)---------------------------------2(0) 
#

Net [

  frequency 1000000000    # 1 nanosecond time resolution

  # new feature since ssfnet_0.9 - control of random number streams.
  # In this example, used by class SSF.OS.TCP.tcpSessionMaster to randomize
  # the TCP system clock phases across all hosts
  
  randomstream [
    generator "MersenneTwister"
    stream "seedstarter1"
    reproducibility_level "timeline"
  ]

  host [
    id 2
    interface [id 0 bitrate 100000000 latency 0.0]
    graph [
      ProtocolSession [
        name client use SSF.OS.TCP.test.tcpClient
        start_time 1.0            # earliest time to send request to server
        start_window 1.0          # send request to server at randomly chosen time
                                  # in interval [start_time, start_time+start_window]
        file_size 10000000        # requested file size (payload bytes)
        request_size  4           # client request datagram size (in bytes)
        show_report true          # print client-server session summary report
        debug false               # print verbose client/server diagnostics
      ]
      ProtocolSession [name socket use SSF.OS.Socket.socketMaster]
      ProtocolSession [name tcp use SSF.OS.TCP.tcpSessionMaster
        tcpinit[
          ISS 10000               # initial sequence number
          MSS 1000                # maximum segment size
          RcvWndSize  32          # receive buffer size
          SendWndSize 32          # maximum send window size
          SendBufferSize 128      # send buffer size
          MaxRexmitTimes 12       # maximum retransmission times before drop 
          TCP_SLOW_INTERVAL 0.5   # granularity of TCP slow timer
          TCP_FAST_INTERVAL 0.2   # granularity of TCP fast(delay-ack) timer
          MSL 60.0                # maximum segment lifetime
          MaxIdleTime 600.0       # maximum idle time for drop a connection
          delayed_ack false       # delayed ack option
          fast_recovery true      # implement fast recovery algorithm 
          show_report true        # print a summary connection report
        ]
      ]
      ProtocolSession [name ip use SSF.OS.IP]
    ]
  ]
      
  host [
    id 1
    interface [id 0 bitrate 100000000 latency 0.0]
    graph [
      ProtocolSession [
        name server use SSF.OS.TCP.test.tcpServer
        port 1600               # server's well known port
        client_limit  10        # max number of contemporaneously allowed clients
                                # if omitted, default is no limit
        request_size  4         # client request datagram size (in bytes) - the same as in client
        show_report true        # print client-server session summary report
        debug false             # print verbose client/server diagnostics
      ]
      ProtocolSession [name socket use SSF.OS.Socket.socketMaster]
      ProtocolSession [name tcp use SSF.OS.TCP.tcpSessionMaster
        tcpinit[
          ISS 10000               # initial sequence number
          MSS 1000                # maximum segment size
          RcvWndSize  32          # receive buffer size
          SendWndSize 32          # maximum send window size
          SendBufferSize 128      # send buffer size
          MaxRexmitTimes 12       # maximum retransmission times before drop 
          TCP_SLOW_INTERVAL 0.5   # granularity of TCP slow timer
          TCP_FAST_INTERVAL 0.2   # granularity of TCP fast(delay-ack) timer
          MSL 60.0                # maximum segment lifetime
          MaxIdleTime 600.0       # maximum idle time for drop a connection
          delayed_ack false       # delayed ack option
          fast_recovery true      # implement fast recovery algorithm 
          show_report true        # print a summary connection report
        ]
      ]
      ProtocolSession [name ip use SSF.OS.IP]
    ]
  ]

  link [attach 1(0) attach 2(0) delay 0.002]

  traffic [
    pattern [
      client 2
      servers [nhi 1(0) port 1600]
    ]
  ]
  
] # end of Net