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

UDP server socket

hi!

whats the maximum number of datagrams that can queue up on a UDP server
socket? or is that system dependent?
i have some code that iteratively handles datagrams, and while testing it,
i noticed that it responds to at most 3 datagrams (i tried sending 4, 6, 8
and 10 datagrams / second)
is that a system dependent feature or can i change that (i didn't see
anything in the manual)

thanks

cheers


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Jul 18 '05 #1
4 3477
Ajay wrote:
whats the maximum number of datagrams that can queue up on a UDP server
socket? or is that system dependent?
i have some code that iteratively handles datagrams, and while testing it,
i noticed that it responds to at most 3 datagrams (i tried sending 4, 6, 8
and 10 datagrams / second)
is that a system dependent feature or can i change that (i didn't see
anything in the manual)


I don't believe (though I'm not an expert in UDP) that you can
"queue up" UDP packets at all. At least, there are explicitly
NO guarantees as to whether any given packet will even make it
through the network, and I doubt any system provides explicit
guarantees as to how many UDP packets can be handled if there
is a backlog. If you are looking for reliable communications,
that's what TCP is for... otherwise you have to handle missed
or duplicated packets yourself.

-Peter
Jul 18 '05 #2
Quoting Peter L Hansen <pe***@engcorp.com>:
Ajay wrote:
whats the maximum number of datagrams that can queue up on a UDP

server
socket? or is that system dependent?
i have some code that iteratively handles datagrams, and while testing

it,
i noticed that it responds to at most 3 datagrams (i tried sending 4,

6, 8
and 10 datagrams / second)
is that a system dependent feature or can i change that (i didn't see
anything in the manual)


I don't believe (though I'm not an expert in UDP) that you can
"queue up" UDP packets at all. At least, there are explicitly
NO guarantees as to whether any given packet will even make it
through the network, and I doubt any system provides explicit
guarantees as to how many UDP packets can be handled if there
is a backlog. If you are looking for reliable communications,
that's what TCP is for... otherwise you have to handle missed
or duplicated packets yourself.

-Peter
--
http://mail.python.org/mailman/listinfo/python-list


i am afraid i have to stick with UDP and reliability is no issue. i used
the word queue but what i really meant was buffer and what i really want
to know is how many packets get buffered (the ones that make through).
i dont believe that when i send 10 packets, 7 get lost and 3 make it
through. Since when i send 3, i always get all 3 (well except perhaps once
or twice) but i can never get any more than 3. i want to confirm if this is
a buffering issue
in my code i do something like
while 1:
data, address = self.UDPserversocket.recvfrom(1024)
#do a lot of processing which usually takes between 4-8 seconds

my question is whether the socket buffers incoming packets, what is the
size of the buffer and is there any way of increasing it.
If not, a solution may be to carry the processing in another thread, but
thats going to increase the overhead (the app. is for a PDA).

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Jul 18 '05 #3

"Ajay" <ab******@mail.usyd.edu.au> wrote in message
news:ma**************************************@pyth on.org...
whats the maximum number of datagrams that can queue up on a UDP server
socket? or is that system dependent?


It's system dependent; depends how much buffer space the kernel wants to
give away. Pulling numbers out of the air I would have thought that some value
between 8kB and 64kB would be typical.

getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF) and the
corresponding setsockopt call appear to be what you want, though I've never
had cause to use them.
Jul 18 '05 #4
In article <ma**************************************@python.o rg>,
Ajay <ab******@mail.usyd.edu.au> wrote:
....
my question is whether the socket buffers incoming packets, what is the
size of the buffer and is there any way of increasing it.
If not, a solution may be to carry the processing in another thread, but
thats going to increase the overhead (the app. is for a PDA).


I assume you're testing and encountering this result on a PDA, too.
I have never worked with one myself, but I assume that a platform
with more limited resources like that will naturally make more
conservative assumptions about the necessary size of buffers and
so forth.

In a simple test on MacOS X, I find that a stopped server can
wake up and process 100 or so datagrams that had been previously
sent to it, of sort of random length between 1 and 74 bytes.
I expect it could handle a lot more than that, and the same
would be true of any PC or server class Berkeley UNIX or similar.
Of course you would think the datagrams' size would have something
to do with it.

Donn Cave, do**@u.washington.edu
Jul 18 '05 #5

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

Similar topics

0
by: Google Mike | last post by:
After a lot of thought and research, and playing with FreeTDS and InlineTDS, as well as various ODBC connections, I have determined that the fastest and cheapest way to get up and going with PHP on...
4
by: zbcong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting for a...
2
by: zhebincong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting...
0
by: Macca | last post by:
Hi, I am writing an asychronous socket server to handle 20+ simulataneous connections. I have used the example in MSDN as a base. The code is shown at end of question. Each connection has a...
8
by: swell | last post by:
I would like to write a server with the low level API of python ( socket+select and/or socket+thread ) that allow me to register client and update them every X seconds ( could be the time, the...
4
by: Engineerik | last post by:
I am trying to create a socket server which will listen for connections from multiple clients and call subroutines in a Fortran DLL and pass the results back to the client. The asynchronous socket...
7
by: David | last post by:
i think i just realized i'm an idiot. again. (not syntactically correct code... just pieces to illustrate) class StateObject { members like socket, receiveBuffer, receiveBufferSize,...
3
by: khu84 | last post by:
Here is client server very simple code, seems to work with telnet but with with web client code gives blank output. Following is the server code:- <? function...
1
by: danfolkes | last post by:
Hey Everyone, I am trying to send repeated messages from a "Node" to a "Server". It works the first time I send the from the Node to Server, but after that it either errors, or does not do...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.