无法在omnet ++ / inet模块中解析目标地址

时间:2016-08-10 20:48:26

标签: omnet++ inet

我正在尝试使用INET模块设计3层数据中心模型。但是当我运行网络时,每次创建TCP套接字时我都会收到下面提到的错误:

starting session
issuing OPEN command
cannot resolve destination address: 

我的文件如下:

Ned for the rack

import inet.nodes.inet.Router;
import inet.nodes.inet.StandardHost;
import inet.nodes.ethernet.Eth10M;
import inet.networklayer.autorouting.ipv4.IPv4NetworkConfigurator;


module Rack
{

    parameters:
        //int N @prompt(“Nodes per rack”);
        int N = default(10)

        @display("bgb=392,190");
    gates:
        inout iogate[];

    submodules:
        ComputingServer[N]: StandardHost {
            @display("p=120,91");
        }
        AccessRouter: Router {

            @display("p=289,91");
        }
        configurator: IPv4NetworkConfigurator;

connections:

        for i=0..N-1 {
            AccessRouter.ethg++ <--> Eth10M <--> ComputingServer[i].ethg++;
        }
        AccessRouter.ethg++ <--> iogate++;
        AccessRouter.ethg++ <--> iogate++;
}

Ned for the network

import inet.nodes.inet.Router;
import inet.nodes.inet.StandardHost;
import inet.nodes.ethernet.Eth100M;
import inet.networklayer.autorouting.ipv4.IPv4NetworkConfigurator;

network Basic_dcn_tcp
{
    parameters:
        int N = default(4);
        int AGR = default(4);
        int CR = default(2);

    submodules:

        AGRouter[AGR]: Router {
            @display("p=131,167");
        }
        CRouter[CR]: Router {
            @display("p=204,52");
        }
        Racks[N]: Rack {
            @display("p=131,304");
        }
        configurator: IPv4NetworkConfigurator;

    connections allowunconnected:

        for i=0..CR-1, for j=0..AGR-1 {
            CRouter[i].ethg++ <--> Eth100M <--> AGRouter[j].ethg++;
        }

        for i=0..1, for j=0..1 {
            AGRouter[i].ethg++ <--> Eth100M <--> Racks[j].iogate++;
        }

        for i=2..3, for j=2..3 {
            AGRouter[i].ethg++ <--> Eth100M <--> Racks[j].iogate++;
        }
}

ini文件如下:

[Config basic_dcn]
network = Basic_dcn_tcp

**.tcpType = "TCP"
**.tcp.advertisedWindow = 65535
**.tcp.delayedAcksEnabled = false
**.tcp.increasedIWEnabled = false
**.tcp.limitedTransmitEnabled = false
**.tcp.mss = 1452
**.tcp.nagleEnabled =true 
**.tcp.receiveQueueClass = default
**.tcp.recordStats = true
**.tcp.sackSupport = false
**.tcp.sendQueueClass = default
**.tcp.tcpAlgorithmClass = default
**.tcp.timestampSupport = true
**.tcp.windowScalingSupport = false


**.numTcpApps = 1
**.tcpApp[*].typename="TCPBasicClientApp"
**.tcpApp[*].localAddress = ""
**.tcpApp[*].localPort = -1
**.tcpApp[*].connectPort = 80
**.tcpApp[*].startTime = 0s
**.tcpApp[*].requestLength = 350B
**.tcpApp[*].replyLength = 5MiB
**.tcpApp[*].numRequestsPerSession = 1
**.tcpApp[*].thinkTime = 3s
**.tcpApp[*].idleInterval = 10s
**.tcpApp[*].reconnectInterval = 50s


**.tcpApp[*].dataTransferMode = "object"

请帮我纠正错误。我刚开始使用inet进行编码。

1 个答案:

答案 0 :(得分:1)

有两个错误:

  1. TCP连接是非对称的,它需要客户端和服务器。 TCPBasicClientApp仅限客户端应用程序。作为服务器,您应该使用TCPGenericSrvApp,参考。 INET Manual
  2. 您没有写入TCP连接的目标地址。您应该确定哪个或哪些主机将是服务器(即侦听传入连接),以及哪些主机将建立连接(即充当客户端)。
  3. 例如:假设ComputingServer[0]中的Racks[0]是服务器并且它侦听端口号80,并且所有其他主机都连接到它,那么omnetpp.ini应该是这样的:

    [Config basic_dcn]
    network = Basic_dcn_tcp
    
    **.tcpType = "TCP"
    **.tcp.advertisedWindow = 65535
    **.tcp.delayedAcksEnabled = false
    **.tcp.increasedIWEnabled = false
    **.tcp.limitedTransmitEnabled = false
    **.tcp.mss = 1452
    **.tcp.nagleEnabled =true 
    **.tcp.receiveQueueClass = default
    **.tcp.recordStats = true
    **.tcp.sackSupport = false
    **.tcp.sendQueueClass = default
    **.tcp.tcpAlgorithmClass = default
    **.tcp.timestampSupport = true
    **.tcp.windowScalingSupport = false
    
    
    **.numTcpApps = 1
    **.tcpApp[*].startTime = 0s
    **.tcpApp[*].requestLength = 350B
    **.tcpApp[*].replyLength = 5MiB
    **.tcpApp[*].numRequestsPerSession = 1
    **.tcpApp[*].thinkTime = 3s
    **.tcpApp[*].idleInterval = 10s
    **.tcpApp[*].reconnectInterval = 50s
    
    **.tcpApp[*].dataTransferMode = "object"
    
    # Racks[0].ComputingServer[0] listens on port 80
    *.Racks[0].ComputingServer[0].tcpApp[*].typename = "TCPGenericSrvApp"
    *.Racks[0].ComputingServer[0].tcpApp[*].localPort = 80
    *.Racks[0].ComputingServer[0].tcpApp[*].localAddress = "" 
    
    # all other hosts connect to  Racks[0].ComputingServer[0]
    *.Racks[*].ComputingServer[*].tcpApp[*].typename = "TCPBasicClientApp"
    *.Racks[*].ComputingServer[*].tcpApp[*].localPort = -1
    *.Racks[*].ComputingServer[*].tcpApp[*].connectAddress = "Basic_dcn_tcp.Racks[0].ComputingServer[0]"
    *.Racks[*].ComputingServer[*].tcpApp[*].connectPort = 80
    

    线索:在INET中,可以使用主机名作为IP地址 此外,我建议从@display()文件中删除所有NED指令,因为它们会在同一位置创建所有对象(该类型)。如果没有@display()模拟环境,将选择每个模块的正确位置。