stateful proxy nodes

86 views
Skip to first unread message

nahid

unread,
Oct 30, 2017, 3:27:31 PM10/30/17
to ns-3-users
Hi all,
I am trying to simulate a network consist of a server, n clients and m proxy servers. my clients can only see proxies and connect them. proxies are my clients sink application. I want my proxies to forward the exact traffic to  server( server is sink for my proxies) and return back the servers response to clients. How can I achieve this? can anybody help me with that?

Tommaso Pecorella

unread,
Oct 30, 2017, 7:20:42 PM10/30/17
to ns-3-users
Hi,

it shouldn't be hard. Just modify one of the applications in the src/applications/model directory to receive and forward your traffic.

T.

nahid

unread,
Nov 7, 2017, 5:16:30 AM11/7/17
to ns-3-users
Thanks for your reply.
I have tried to change packetSink in the src/applications to send the receiving packets to my server. but I have a problem. Proxies send packets to server correctly but they send acks for clients. I want to return server's answer to clients not the proxies answer. How can I prevent tcp default behavior to answer the receiving packet?

thanks.

nahid

unread,
Nov 7, 2017, 5:18:58 AM11/7/17
to ns-3-users
I mean proxies have to wait for server response and then return that response to clients.

Tommaso Pecorella

unread,
Nov 7, 2017, 6:37:25 PM11/7/17
to ns-3-users
Well, that's all in the application logic:
- receive a request
- forward to the server
- wait for the reply
- forward to the client

Considering that you'll have 2 sockets (one from/to the client and one from/to the server) you can couple them. However the coupling will have to be done in the HandleAccept callback.
Every TCP socket will fire a HandleAccept callback (if set) when a new connection is made.
I'd expect that fo every new connection from a client you'll open a new connection to the server - in the HandleAccept is the best option.
Afterwards, you can just check where a request (or reply) comes from just by checking the socket, and forward it to the other one.

Hope it is clear,

T.

nahid

unread,
Nov 10, 2017, 3:24:28 AM11/10/17
to ns-3-users
Thanks. I have  tried that. I start connection to server when clients connect to proxy. and I call my own method , "SendPacket" at the end of HandleRead method to send receiving packets to server. but the problem is that still proxy sned packet ack to clients before receiving server's answer. how can I say proxy to wait for the reply??

thanks.

Tommaso Pecorella

unread,
Nov 10, 2017, 11:35:04 AM11/10/17
to ns-3-users
Hi,

the ACK is unavoidable.

T.

nahid

unread,
Dec 10, 2017, 5:28:08 AM12/10/17
to ns-3-users
So, What can I do to keep session alive? because when the Ack is received the client application calls dodispose method and I lose the socket and consequently I can't return server's response to client. how can I solve this?

Tommaso Pecorella

unread,
Dec 10, 2017, 5:27:53 PM12/10/17
to ns-3-users
If your client closes the connection when it receives an ACK, then there's a bug in your application (or you didn't fully understood how it works).

T.

nahid

unread,
Dec 11, 2017, 1:33:32 AM12/11/17
to ns-3-users
Sorry I am new to ns3. How can I get the event of ack received by client? Or event of ack sent by server?

nahid

unread,
Dec 11, 2017, 2:49:46 AM12/11/17
to ns-3-users
And Another thing is that I am using http client and server introduced here. for the proxy server I have changed the server code to implement new proxy application for forwarding requests and answers.

Tommaso Pecorella

unread,
Dec 11, 2017, 6:13:20 PM12/11/17
to ns-3-users
You should study TCP, not ns-3. ACKs are at TCP-level.

T.
Reply all
Reply to author
Forward
0 new messages