473,587 Members | 2,509 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UDP and Packet size

I am designing a UDP server(still on paper) that will receive data from
various client applications(re siding on PocketPCs using GPRS)
I am using Richard Blum's 'C# Network Programming' as my guide.
One thing I wanted clarification on was, when the author says "UDP
maintains message boundary", does it mean that the Server will always
receive an entire message or not receive it ? What if the Client sends a
large message(say 5K) and it gets broken into multiple packets in the
process of transmission across networks(I was reading on newsgroups that its
possible), does it get reassembled before it reaches the server ? Can only
part of the message ever make to the server ? Is there anyway I can check on
the server side that the message is not whole/complete ?
If it is that the wholeness of a message can be verified on the
Client/Server, I do not want to get into breaking a message into smaller(512
bytes) and then reassembling them. That will add a lot of complexity. 80% of
our messages are well under 500 bytes. So a few retransmissions (just
assuming the probability of breaking a message by the network is low) will
be better than the complexity of splitting/combining messages.

Thanks in advance for any info.
Srinivas
Nov 16 '05 #1
6 3282
SRLoka wrote:
I am designing a UDP server(still on paper) that will receive data from
various client applications(re siding on PocketPCs using GPRS)
I am using Richard Blum's 'C# Network Programming' as my guide.
One thing I wanted clarification on was, when the author says "UDP
maintains message boundary", does it mean that the Server will always
receive an entire message or not receive it ? What if the Client sends a
large message(say 5K) and it gets broken into multiple packets in the
process of transmission across networks(I was reading on newsgroups that its
possible), does it get reassembled before it reaches the server ?
Yes, they get reassembled. It's called IP-Fragmentation and it's
handled by the IP-protocol (the underlying protocol of UDP).
Can only
part of the message ever make to the server ?


No.

However, you still must deal with these situations:

- a packet may never arrive
- a packet may arrive in the wrong order

So you must mark the packets with a sequence number
or design your protocol to be stateless.

bye
Rob
Nov 16 '05 #2
> However, you still must deal with these situations:

- a packet may never arrive
- a packet may arrive in the wrong order
We have a strategy for dealing with "packets never arriving". We will use
"ack" and retry tineouts.
All our packets are independent of each other. All of them are simple
messages like a chat program. So does that mean we never have to worry about
packet order ?

Thanks for the reply
"Robert Jordan" <ro*****@gmx.ne t> wrote in message
news:ch******** *****@news.t-online.com... SRLoka wrote:
I am designing a UDP server(still on paper) that will receive data from various client applications(re siding on PocketPCs using GPRS)
I am using Richard Blum's 'C# Network Programming' as my guide.
One thing I wanted clarification on was, when the author says "UDP
maintains message boundary", does it mean that the Server will always
receive an entire message or not receive it ? What if the Client sends a
large message(say 5K) and it gets broken into multiple packets in the
process of transmission across networks(I was reading on newsgroups that its possible), does it get reassembled before it reaches the server ?


Yes, they get reassembled. It's called IP-Fragmentation and it's
handled by the IP-protocol (the underlying protocol of UDP).
> Can only
part of the message ever make to the server ?


No.

However, you still must deal with these situations:

- a packet may never arrive
- a packet may arrive in the wrong order

So you must mark the packets with a sequence number
or design your protocol to be stateless.

bye
Rob

Nov 16 '05 #3
SRLoka wrote:
However, you still must deal with these situations:

- a packet may never arrive
- a packet may arrive in the wrong order

We have a strategy for dealing with "packets never arriving". We will use
"ack" and retry tineouts.
All our packets are independent of each other. All of them are simple
messages like a chat program. So does that mean we never have to worry about
packet order ?


The packets may be independend, but they may contain
informations your application is expecting in a certain order.
Try to design the protocol to be stateless, that means:
at any time you must be able to handle any message w/out the
knowlege of what happend before.

bye
Rob

Thanks for the reply
"Robert Jordan" <ro*****@gmx.ne t> wrote in message
news:ch******** *****@news.t-online.com...
SRLoka wrote:

I am designing a UDP server(still on paper) that will receive data
from
various client applications(re siding on PocketPCs using GPRS)
I am using Richard Blum's 'C# Network Programming' as my guide.
One thing I wanted clarification on was, when the author says "UDP
maintains message boundary", does it mean that the Server will always
receive an entire message or not receive it ? What if the Client sends a
large message(say 5K) and it gets broken into multiple packets in the
process of transmission across networks(I was reading on newsgroups that
its
possible), does it get reassembled before it reaches the server ?


Yes, they get reassembled. It's called IP-Fragmentation and it's
handled by the IP-protocol (the underlying protocol of UDP).
> Can only

part of the message ever make to the server ?


No.

However, you still must deal with these situations:

- a packet may never arrive
- a packet may arrive in the wrong order

So you must mark the packets with a sequence number
or design your protocol to be stateless.

bye
Rob


Nov 16 '05 #4
SRLoka wrote:
However, you still must deal with these situations:

- a packet may never arrive
- a packet may arrive in the wrong order

We have a strategy for dealing with "packets never arriving". We will use
"ack" and retry tineouts.
All our packets are independent of each other. All of them are simple
messages like a chat program. So does that mean we never have to worry about
packet order ?


The packets may be independend, but they may contain
informations your application is expecting in a certain order.
Try to design the protocol to be stateless, that means:
at any time you must be able to handle any message w/out the
knowlege of what happend before.

bye
Rob

Thanks for the reply
"Robert Jordan" <ro*****@gmx.ne t> wrote in message
news:ch******** *****@news.t-online.com...
SRLoka wrote:

I am designing a UDP server(still on paper) that will receive data
from
various client applications(re siding on PocketPCs using GPRS)
I am using Richard Blum's 'C# Network Programming' as my guide.
One thing I wanted clarification on was, when the author says "UDP
maintains message boundary", does it mean that the Server will always
receive an entire message or not receive it ? What if the Client sends a
large message(say 5K) and it gets broken into multiple packets in the
process of transmission across networks(I was reading on newsgroups that
its
possible), does it get reassembled before it reaches the server ?


Yes, they get reassembled. It's called IP-Fragmentation and it's
handled by the IP-protocol (the underlying protocol of UDP).
> Can only

part of the message ever make to the server ?


No.

However, you still must deal with these situations:

- a packet may never arrive
- a packet may arrive in the wrong order

So you must mark the packets with a sequence number
or design your protocol to be stateless.

bye
Rob


Nov 16 '05 #5
Thanks. That helps a lot.
Our app does not need the messages in any order. There are simple
notifications and the receiving app has no logic that dependes on the
message order.

"Robert Jordan" <ro*****@gmx.ne t> wrote in message
news:ch******** *****@news.t-online.com...
SRLoka wrote:
However, you still must deal with these situations:

- a packet may never arrive
- a packet may arrive in the wrong order

We have a strategy for dealing with "packets never arriving". We will use "ack" and retry tineouts.
All our packets are independent of each other. All of them are simple
messages like a chat program. So does that mean we never have to worry about packet order ?


The packets may be independend, but they may contain
informations your application is expecting in a certain order.
Try to design the protocol to be stateless, that means:
at any time you must be able to handle any message w/out the
knowlege of what happend before.

bye
Rob

Thanks for the reply
"Robert Jordan" <ro*****@gmx.ne t> wrote in message
news:ch******** *****@news.t-online.com...
SRLoka wrote:
I am designing a UDP server(still on paper) that will receive data


from
various client applications(re siding on PocketPCs using GPRS)
I am using Richard Blum's 'C# Network Programming' as my guide.
One thing I wanted clarification on was, when the author says "UDP
maintains message boundary", does it mean that the Server will always
receive an entire message or not receive it ? What if the Client sends alarge message(say 5K) and it gets broken into multiple packets in the
process of transmission across networks(I was reading on newsgroups
that
its
possible), does it get reassembled before it reaches the server ?

Yes, they get reassembled. It's called IP-Fragmentation and it's
handled by the IP-protocol (the underlying protocol of UDP).

> Can only

part of the message ever make to the server ?

No.

However, you still must deal with these situations:

- a packet may never arrive
- a packet may arrive in the wrong order

So you must mark the packets with a sequence number
or design your protocol to be stateless.

bye
Rob


Nov 16 '05 #6
Thanks. That helps a lot.
Our app does not need the messages in any order. There are simple
notifications and the receiving app has no logic that dependes on the
message order.

"Robert Jordan" <ro*****@gmx.ne t> wrote in message
news:ch******** *****@news.t-online.com...
SRLoka wrote:
However, you still must deal with these situations:

- a packet may never arrive
- a packet may arrive in the wrong order

We have a strategy for dealing with "packets never arriving". We will use "ack" and retry tineouts.
All our packets are independent of each other. All of them are simple
messages like a chat program. So does that mean we never have to worry about packet order ?


The packets may be independend, but they may contain
informations your application is expecting in a certain order.
Try to design the protocol to be stateless, that means:
at any time you must be able to handle any message w/out the
knowlege of what happend before.

bye
Rob

Thanks for the reply
"Robert Jordan" <ro*****@gmx.ne t> wrote in message
news:ch******** *****@news.t-online.com...
SRLoka wrote:
I am designing a UDP server(still on paper) that will receive data


from
various client applications(re siding on PocketPCs using GPRS)
I am using Richard Blum's 'C# Network Programming' as my guide.
One thing I wanted clarification on was, when the author says "UDP
maintains message boundary", does it mean that the Server will always
receive an entire message or not receive it ? What if the Client sends alarge message(say 5K) and it gets broken into multiple packets in the
process of transmission across networks(I was reading on newsgroups
that
its
possible), does it get reassembled before it reaches the server ?

Yes, they get reassembled. It's called IP-Fragmentation and it's
handled by the IP-protocol (the underlying protocol of UDP).

> Can only

part of the message ever make to the server ?

No.

However, you still must deal with these situations:

- a packet may never arrive
- a packet may arrive in the wrong order

So you must mark the packets with a sequence number
or design your protocol to be stateless.

bye
Rob


Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3643
by: pdelacruz | last post by:
Hello, I was wondering is the following is correct with the network packet size. I've installed sql server 2000 and made some changes in the configuration. Now i've read that sql server's default network packet size is 4096 bytes, but when i look up the advanced tab, in the optionsmenu of the enterprise manager, the network packetsize is 0!
0
1904
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 the size of the packet. So far, my program works when I force the packet size to be the size of the buffer. However, when I try and change the buffer size to correspond to the packet size, the receiving end does not work. I try to receive the...
1
1633
by: Pieter Claassen | last post by:
Ok, I have something that works, but I don't understand why. I use libpcap to get data of the wire and then initially I casted the packet to ethernet, then marched along the memory in chunks of bytes for the length of the ethernet header until I reached the IP header and so forth... So, I changed my code and now process the ethernet header after which I pass the size of the the ethernet header to be deducted and a pointer to the the...
4
2488
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, "error in recvfrom.\n"); exit(1); } The packet I am receiving has the following possible structure.
12
16892
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 there is not a one to one map between a session and a physical TCP connection. A client may disconnect the TCP connection if it is idle for more than 60 seconds... yet a conceptual "session" may last for days at a time. It's necessary that the...
2
6153
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 would like to put in the header of a packet. 2. I know the size of data I will send and the header size in bytes, so I allocate the space in memory for both and create two pointers: for data part (dataptr) and header part. Header pointer coinsided...
9
2546
by: rattan | last post by:
I want a specific packet format for packet exchange between a client server across the network. For example frame format as a python class could be: class Frame: def __init__(self, buffer=None, count=0, offset=0): self.buffer = buffer self.count = count self.offset = offset the question is how to convert it to a byte stream so that format of count and offset also becomes a sequence of bytes. I tried
4
7056
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 "hello", will it cause 8KB of bandwidth, or 5 bytes (plus TCP/IP packet header, as well, of course). (Btw, I 'set' the packet size via Socket.BeginReceive(), in the "size" field = "The number of bytes to receive." Which seems to imply the answer...
1
4135
by: quddusaliquddus | last post by:
Hi :D, I am sending data to server via TCP IP Connection. I am using a continuous loop at the server end - that accepts new clients and while streams can be read, it reads data stream. The data is sent from the client with 2 leading bytes of data that represent the size of the packet of data sent and type of data. My question is: how do I retrieve the size of the data packet and then check that this amount of data has been...
0
7852
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8349
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7974
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8221
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.