473,396 Members | 2,140 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,396 software developers and data experts.

UDP and Packet size

I am designing a UDP server(still on paper) that will receive data from
various client applications(residing 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 3272
SRLoka wrote:
I am designing a UDP server(still on paper) that will receive data from
various client applications(residing 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.net> 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(residing 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.net> 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(residing 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.net> 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(residing 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.net> 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.net> 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(residing 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.net> 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.net> 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(residing 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
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...
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...
1
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...
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...
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...
9
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,...
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...
1
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. ...
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?
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
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
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,...
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...

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.