473,406 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

packet generation

how to generate packets of different sizes in c++ or c?
Feb 4 '08 #1
7 2667
how to generate packets of different sizes in c++ or c?
Hi ,
I did not get your question, what do you mean by "generate packets"?
Regards
Arul
Feb 4 '08 #2
sicarie
4,677 Expert Mod 4TB
how to generate packets of different sizes in c++ or c?
Huh?

Are you looking to send a single packet, or create a connection between two machines? And which language are you working in? C or C++? You know the two are different, right?
Feb 4 '08 #3
Huh?

Are you looking to send a single packet, or create a connection between two machines? And which language are you working in? C or C++? You know the two are different, right?
we need to create a source which generates packets and we are working in C++.
Feb 5 '08 #4
Hi ,
I did not get your question, what do you mean by "generate packets"?
Regards
Arul

we have to create a transmission source which generates bits in a random manner and we have to divide these random bits into files of different sizes.
Feb 5 '08 #5
sicarie
4,677 Expert Mod 4TB
we have to create a transmission source which generates bits in a random manner and we have to divide these random bits into files of different sizes.
Okay, either you don't really know what you are doing, or you are not explaining it well.

You can research "client server c++" and then use libpcap to capture packets and separate them on one side, but that's about as much help as we can give you until you clarify your requirements a bit more.
Feb 5 '08 #6
Okay, either you don't really know what you are doing, or you are not explaining it well.

You can research "client server c++" and then use libpcap to capture packets and separate them on one side, but that's about as much help as we can give you until you clarify your requirements a bit more.
hi,we have to implement the 2 algorithms given,
Algorithm 1 Adaptive Rate Control
1: ARC with Multi-rate Retransmission and AIMD ST Adjustment.
2: while receiving a packet P dequed from one of the FIFO queues do
3: NextHop = daddr(p);
4: P.dataRate = NextHop.dataRate;
5: send(P);
6: if recvACK() then
7: if retry == 0 then
8: Success++; Failure = 0; Recovery = 0;
9: if Success ≥ ST then
10: NextHop.dataRate ++;
11: Success = 0;
12: ST+ = α; Recovery = 1;
13: end if
14: else if retry > 0 then
15: Success = 0; Failure++;
16: oldRate = NextHop.dataRate;
17: if Failure ≥ FT || Recovery == 1 then
18: NextHop.dataRate −−;
19: Failure = 0;
20: end if
21: if Recovery == 1 then
22: ST+ = α;
23: else if oldRate < NextHop.dataRate then
24: ST/ = β;
25: end if
26: Recovery = 0;
27: end if
28: end if
29: if ACKtimeout() then
30: P.dataRate = lookupMultirateRetry();
31: if retry < retryLimit then
32: retry ++; retransmit(P);
33: else
34: Error++; Success = 0; Failure = 0;
35: Recovery = 0; drop(P);
36: end if
37: end if
38: end while
in the first algorithm we send packets and receive the ACK,if 10 packets sent and only got 2 ACKs we reduce the data rate and send and the process continues..
and in the second algorithm we give the 1st algorithm as a input to the second and schedule the packets..
Algorithm 2 Weighted Fair Scheduling
1: Weighted Fair Scheduling: Gi
wi
=
Gj
wj
, ∀1 ≤ i, j ≤ N.
2: while receiving a packet P from the upper layer do
3: Enque(P);
4: if not blocked then
5: return P = Dequeue();
6: end if
7: end while
1: void Enque(P):
2: qid = findEnqueID(P.daddr());
3: flowQueue[qid].enque(P);
1: Packet* Dequeue():
2: if has not dequed any packet then
3: init_wi();
4: else
5: update_wi() using stochastic approximation;
6: end if
7: for all NextHopi do
8: compute Gi = E[Gi(ri, si)] by (1);
9: WeightedG[i] = ciGi;
10: end for
11: qid = selectBest(WeightedG[ ]);
12: return flowQueue[qid].deque();
please do help..we do this in C++ LINUX environment
Feb 6 '08 #7
seladb
4
You might consider using PcapPlusPlus for packet generation and manipulation
Jan 25 '16 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Marcia Hon | last post by:
Hi, I am using read and send of the socket library. I would like to send packets that have variable length, and I would like to read these packets. I have designated the first 2 bytes to state...
4
by: QQ | last post by:
Hello I am a newbie on network programming. I am trying to receive a packet if((numbytes = recvfrom(udp_fd1, buf, MAXLEN-1, 0,(struct sockaddr*)&register_addr, &addr_len))==-1){ fprintf(stderr,...
2
by: bobrics | last post by:
Hi, I would like to create a packet for a RAW socket transfer. Please let me know if this is the right approach. 1. First, I am creating a header structure where I store all the information I...
10
by: PH | last post by:
Hi guys! I need to get the remote EndPoint from when I receive packets when listening in a local port in my computer. I'm using UDP (connection-less) so I only bind the socket to my...
7
by: owolablo | last post by:
Hi, I'm writing a program that sends 1500 bytes of data at once, from the client to the server. However, the packet is broken down into 3 different segments of 500 each before getting to the...
1
by: visal | last post by:
hi Please help me.i am developing a java pgm to capture network packets using jpcap.i downloded jpcap and wpcap dll files. My pgm is: import jpcap.JpcapHandler; import jpcap.Jpcap; import...
3
by: nexus024 | last post by:
I am trying to write a program that will continuously sniff eth0 for a specific UDP packet thats being sent to a specific destination IP, alter the data of the packet, and finally transmit it to the...
1
by: sangith | last post by:
Hi, I tried the packet capture module program. I did a file transfer using ftp from this host to another server. But when I ran the program, it was just hanging off and it did not print the...
1
by: AngreGanon | last post by:
Hi all~ I've written a network program in C. This program catputures ARP request packet and reply wrong ARP packet. Hi. I've written a small program to learn to write in C. But unfortunately...
4
by: Zytan | last post by:
This may be the dumbest question of all time, but... When I set the packet size, does it mean ALL packets are that size, no matter what? Let's say the packet size is 8KB, and I send a 5 byte...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.