You have to change the destination address and port from the ip header packet 
in the sink agent (Agent3) every time before you sent the packet.

For example:
void TcpSink::ack(Packet* opkt)
        Packet* npkt = allocpkt();
        // opkt is the "old" packet that was received
        // npkt is the "new" packet being constructed (for the ACK)
        double now = Scheduler::instance().clock();

        hdr_tcp *otcp = hdr_tcp::access(opkt);
        hdr_ip *oiph = hdr_ip::access(opkt);
        hdr_tcp *ntcp = hdr_tcp::access(npkt);


        hdr_ip* oip = hdr_ip::access(opkt);
        hdr_ip* nip = hdr_ip::access(npkt);
         * add this                            *

        nip->daddr() = oip->saddr();
        nip->dport() = oip->sport();

         * add this                            *
        // get the ip headers
        nip->flowid() = oip->flowid();
        // copy the flow id


        send(npkt, 0);
        // send it

I hope this helps

Am Mittwoch, 30. August 2006 15:16 schrieb Przemysław Krekora:
> I want to create agent which will have ability to response on the request
> from any agent. Let's say that below is example (which of course doesn't
> work). I would like that for example that TCPSink could response on request
> from tcp1 and tcp2. What should I do ? Example
>    Agent1 comunicate with Agent3
> and at the same time
>    Agent2 comunicate with Agent3
> and Agent1 and Agent2 start talking, Agent3 only response on the request
> I suppose that i should create something like pool but i do not know how
> should i start fight with this.
> Przemyslaw Krekora
> ------------------------------------------------------------------------
> Szybko i tanio ubezpiecz samochod!
> Kupno polisy zajmie Ci 15 minut! Kontakt przez telefon albo Internet.
> Kliknij i sprawdz:

Reply via email to