473,385 Members | 1,740 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,385 software developers and data experts.

How to Built your own UDP Packet of lets say 524 bytes?

7
Hello everybody,
Is there any way i can built my own UDP Packet of any size and then transmit it over the network?
Sep 29 '08 #1
3 1407
Banfa
9,065 Expert Mod 8TB
  1. Open a UDP Socket to the destination (preferably one that is listening for incoming UDP packets).
  2. Put your data in a buffer of usigned char
  3. Send it
  4. Close your link if you have nothing else to send
Sep 29 '08 #2
raghaw
7
ok lets say i have a structure

struct Msg_42
{
Msg_42();//constructor
U32 Vehicle_ID;
U32 CUCS_ID;
U8 Flight_Path_Control_Mode;
};
with a header structure

struct STANAG_Message_Header
{
U8 IDD [10];
U16 Mesasge_Instance_Identifier;
U16 Message_Type;
U32 Message_Length;
S16 Stream_ID;
};


and

final message

struct STANAG_Message
{
struct STANAG_Message_Header st_mh;
char * Message_Data;
U32 checksum;
};


then how tio put this into a UDP Packet
Oct 7 '08 #3
Banfa
9,065 Expert Mod 8TB
Like I said you just open a connection to a UDP socket and send the data you want to in the packet in a single function call (that will mean putting all the data into a single buffer) to send (assuming you are using Berkley sockets or an implementation thereof).

The network layer will handle the nitty gritty of creating the UDP packet headers.
Oct 7 '08 #4

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,...
12
by: David Sworder | last post by:
Hi, I'm writing an application in which a client (C#/WinForms) and server (C#/service) interact with one another. The client establishes a "session" with the server but for scalability reasons...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.