O tema começa aqui - link
Existe um certo emulador- NS-2 .
Ele pode ser usado para descrever a topologia da rede, a configuração da origem e do destino do tráfego, todos os parâmetros de conexão (largura de banda, atraso, probabilidade de perda de pacotes e muitos outros parâmetros do sistema simulado).
Eu instalei o Linux Mandriva 2008 e ele funciona.
Mas não é possível obter visualização - isso é devido com Xorg .
Estou tentando implementar um exemplo simples (repito o código novamente) -
ns-simple.tcl :
#Create a simulator object
set ns [new Simulator]
#Define different colors for data flows (for NAM)
$ns color 1 Blue
$ns color 2 Red
#Open the NAM trace file
set nf [open out.nam w]
$ns namtrace-all $nf
#Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the NAM trace file
close $nf
#Execute NAM on the trace file
exec nam out.nam &
exit 0
}
#Create four nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
#Create links between the nodes
$ns duplex-link $n0 $n2 2Mb 10ms DropTail
$ns duplex-link $n1 $n2 2Mb 10ms DropTail
$ns duplex-link $n2 $n3 1.7Mb 20ms DropTail
#Set Queue Size of link (n2-n3) to 10
$ns queue-limit $n2 $n3 10
#Give node position (for NAM)
$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right
#Monitor the queue for link (n2-n3). (for NAM)
$ns duplex-link-op $n2 $n3 queuePos 0.5
#Setup a TCP connection
set tcp [new Agent/TCP]
$tcp set class_ 2
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n3 $sink
$ns connect $tcp $sink
$tcp set fid_ 1
#Setup a FTP over TCP connection
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set type_ FTP
#Setup a UDP connection
set udp [new Agent/UDP]
$ns attach-agent $n1 $udp
set null [new Agent/Null]
$ns attach-agent $n3 $null
$ns connect $udp $null
Mas recebo uma mensagem de erro.
[root@localhost ...]# startx -- :1
xauth: creating new authority file /root/.serverauth.20336
X Window System Version 1.3.0
Release Date: 19 April 2007
X Protocol Version 11, Revision 0, Release 1.3
Build Operating System: Linux_2.6.12-12mdksmp Mandriva
Current Operating System: Linux localhost 2.6.22.9-desktop-1mdv #1 SMP Thu Sep 27 04:07:04 CEST 2007 i686
Build Date: 01 October 2007
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Sat Dec 29 18:59:34 2012
(==) Using config file: "/etc/X11/xorg.conf"
Using vt 8
(**) RADEON(0): RADEONPreInit
(II) Module already built-in
(II) Module already built-in
(II) Module already built-in
(**) RADEON(0): RADEONScreenInit d0000000 0
(**) RADEON(0): Map: 0xd0000000, 0x01000000
(**) RADEON(0): RADEONSave
(**) RADEON(0): RADEONSaveMode(0x823a6a0)
(**) RADEON(0): Read: 0x00000006 0x00030047 0x00000000
(**) RADEON(0): Read: rd=6, fd=71, pd=3
(**) RADEON(0): RADEONSaveMode returns 0x823a6a0
(**) RADEON(0): RADEONInitMemoryMap() :
(**) RADEON(0): mem_size : 0x04000000
(**) RADEON(0): MC_FB_LOCATION : 0xd3ffd000
(**) RADEON(0): MC_AGP_LOCATION : 0xffffffc0
(**) RADEON(0): RADEONModeInit()
1024x768 78.75 1024 1040 1136 1312 768 769 772 800 (16,16) +H +V
1024x768 78.75 1024 1040 1136 1312 768 769 772 800 (16,16) +H +V
(**) RADEON(0): Pitch = 8388736 bytes (virtualX = 1024, displayWidth = 1024)
(**) RADEON(0): dc=7875, of=15750, fd=350, pd=2
(**) RADEON(0): RADEONInit returns 0x823b050
(**) RADEON(0): RADEONRestoreMode()
(**) RADEON(0): RADEONRestoreMemMapRegisters() :
(**) RADEON(0): MC_FB_LOCATION : 0xd3ffd000
(**) RADEON(0): MC_AGP_LOCATION : 0xffffffc0
(**) RADEON(0): Map Changed ! Applying ...
(**) RADEON(0): Map applied, resetting engine ...
(**) RADEON(0): Updating display base addresses...
(**) RADEON(0): Memory map updated.
(**) RADEON(0): Programming CRTC1, offset: 0x00000000
(**) RADEON(0): Wrote: 0x0000003c 0x0001015e 0x00000000 (0x0000bf00)
(**) RADEON(0): Wrote: rd=60, fd=350, pd=1
(**) RADEON(0): GRPH_BUFFER_CNTL from 20005c5c to 20055c5c
(**) RADEON(0): RADEONSaveScreen(0)
(**) RADEON(0): Setting up initial surfaces
(**) RADEON(0): Initializing fb layer
(**) RADEON(0): Setting up accel memmap
(**) RADEON(0): Initializing backing store
(**) RADEON(0): Setting up final surfaces
(**) RADEON(0): Initializing Acceleration
(**) RADEON(0): EngineInit (16/16)
(**) RADEON(0): Pitch for acceleration = 128
(**) RADEON(0): EngineRestore (16/16)
(**) RADEON(0): Initializing DPMS
(**) RADEON(0): Initializing Cursor
(**) RADEON(0): Initializing color map
(**) RADEON(0): Initializing DGA
(**) RADEON(0): Initializing Xv
(**) RADEON(0): RADEONScreenInit finished
(EE) AIGLX: Screen 0 is not DRI capable
(**) RADEON(0): RADEONSaveScreen(2)
Executar ns :
[root@localhost ...]# export DISPLAY=localhost:1
[root@localhost ...]# ns ns-simple.tcl
CBR packet size = 1000
CBR interval = 0.0080000000000000002
[root@localhost ...]# **nam: couldn't connect to display "localhost:1"**
Eu tentei reconstruir o nam , como eles dizem aqui , minha função remote-create-animator
se parece com isso -
AnimControl instproc remote-create-animator {trace_file args} {
catch "array set opts $args"
AnimControl instvar PORT_FILE_
if [catch {set f [open $PORT_FILE_ RDONLY]}] {
error "Cannot read server port from $PORT_FILE_"
}
set port [read $f]
close $f
puts -nonewline "Cannot connect to existing nam instance. "
puts "Starting a new one..."
$self local-create-animator $trace_file [join $args]
#if [catch {set sock [socket localhost $port]}] {
# puts -nonewline "Cannot connect to existing nam instance. "
# puts "Starting a new one..."
# $self local-create-animator $trace_file [join $args]
#} else {
# if {$trace_file == ""} {
# puts "A nam instance already exists. Use nam <trace file> to view an animation"
# close $sock
# } else {
# global tcl_platform
# if {$tcl_platform(platform) == "windows"} {
# if [regexp {^(\\|[A-Za-z]:[/\])} $trace_file] {
# set tf $trace_file ;# Absolute pathname
# } else {
# set tf [pwd]/$trace_file ;# Relative pathname
# }
# } else {
# if [regexp {^[~/]} $trace_file] {
# set tf $trace_file ;# Absolute pathname
# } else {
# set tf [pwd]/$trace_file ;# Relative pathname
# }
# }
# puts $sock "CA $tf [join $args]"
# flush $sock
# close $sock
# }
#}
}
Mas nada mudou. A mensagem agora é - "Cannot connect to existing nam instance. Starting a new one..."
E tudo ..
Como obter a foto? Eu ficaria muito grato pela informação!
Obrigado!