Send and receive of packet at same time (ad-hoc application)

193 views
Skip to first unread message

Milad Mhb

unread,
Jan 22, 2016, 6:18:00 AM1/22/16
to ns-3-users
Hi all,

I am developing an ad-hoc client/server application, following are my requirement:

Client: Sends hello message every 1sec (no receiving for now)
Server: Sends broadcast hello message every 1sec and at same time must receive client hello message as well.

for developing this I created 2 socket in a server application, (one socket for server broadcasting only , and one for unicast communication with clients).

but because client and server try to send at same time packets get disappear (even though they send over different sockets).

Please note: if I do the same scenario with only one socket everything work fine but because every 1sec server need to broadcast packet and at same it may send unicast packet I used two socket to avoid changing of remote IP address every time from Broadcast-IP to Client-IP.

Any suggestion will help.

Thanks.

Konstantinos

unread,
Jan 22, 2016, 6:36:27 AM1/22/16
to ns-3-users
Yes, try to give some randomness to the start of the applications.
The problem is collisions, not the use of multiple sockets.

Regards,
K.

Milad Mhb

unread,
Jan 22, 2016, 9:51:18 AM1/22/16
to ns-3-users
Your solution worked perfectly. 

Thank you.

Regards

Milad Mhb

Milad Mhb

unread,
Jan 23, 2016, 1:18:43 AM1/23/16
to ns-3-users
Then I have a question..

If the problem is collisions, it means there is no collision control mechanism, but I though devices are already using CSMA/CA.
is it true?

Regards

On Friday, 22 January 2016 17:06:27 UTC+5:30, Konstantinos wrote:

Konstantinos

unread,
Jan 23, 2016, 5:42:16 AM1/23/16
to ns-3-users
Hi,

CSMA/CA is implemented, but the problem in non-random timers in ARP.
The issue reported in the documentation and the above solution is in accordance to real systems (i.e. not all nodes start exactly at the same time, there is some variance, even 1ms). For future events, i.e. packets arriving at the same time, random backoff (CSMA/CA) will take care of collisions.

K.
Reply all
Reply to author
Forward
0 new messages